hmos-apifault-analysis

Diagnose HarmonyOS API failures from error codes, hilog, and HiviewDFX crash logs.

2|Updated Jun 21, 2026
One-click install
npx skills add https://github.com/IsKenKenYa/skills --skill hmos-apifault-analysis-iskenkenya
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hmos-apifault-analysis
Source: https://github.com/IsKenKenYa/skills/tree/main/skills/harmonyos/solutions/quality/stability/hmos-apifault-analysis
Command: npx skills add https://github.com/IsKenKenYa/skills --skill hmos-apifault-analysis-iskenkenya

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? HarmonyOS developers often receive cryptic error codes (like 5400xxx, 801, 9200) or crash/freeze logs without knowing which module failed or why. This Skill replaces guesswork with a structured six-stage diagnostic workflow that traces failures from logs and source code down to the concrete application-side operation that caused them, producing an actionable diagnosis report. ## Core Features & Use Cases - Structured Six-Stage Diagnosis: Runs environment discovery, clue extraction, module identification, log collection, triage against knowledge bases, deep-dive analysis, and project source code review, ending in a standardized Markdown report. - Automated Log Collection: Pulls and decodes device hilog files via hdc using hilogtool (with gzip fallback), captures in-memory log buffers, and tracks state machine transitions across the timeline. - Module & Error Code Mapping: Maps error code prefixes, DOMAIN identifiers, .so library names, API prefixes, and hilog domain IDs to specific OpenHarmony modules with links to source and documentation repositories. - Media File Analysis: Validates media files (MP4, MKV, TS, AAC, MP3, FLAC, WAV, OGG, AMR) for format support, truncation, and corruption when Media Kit errors 5400103/5400106/5400102 appear. - Use Case: A developer hits error 5400106 when playing a video. The Skill collects device logs, identifies the multimedia_player_framework module, analyzes the media file for corruption, inspects the project's AVPlayer usage, and delivers a report ranking root causes with code fix suggestions. ## Quick Start Ask the agent to analyze your HarmonyOS problem by providing the error description and log file, for example: use hmos-apifault-analysis to diagnose error code 5400103 with the attached hilog file and my player code snippet.

Frequently Asked Questions about hmos-apifault-analysis

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I diagnose HarmonyOS API call failures and error codes?

Provide the problem description plus any error code, log content, or code snippet. The Skill extracts clues, maps error code prefixes to modules, queries knowledge bases and official docs, analyzes your project source, and outputs a structured report with ranked root causes and fix suggestions.

How to collect and decode hilog logs from a HarmonyOS device?

The Skill runs hilog_collector.py over hdc to pull device logs, decoding binary hilog with hilogtool from the SDK (falling back to gzip). It also captures the in-memory buffer via hilog -x and can enable log persistence when no on-disk logs exist.

Does it work without a connected device or project source code?

Yes. Every stage is still attempted; when a device or project is unavailable, the gap is recorded in the report with its impact on diagnostic confidence, and conclusions are drawn from static analysis of whatever logs or descriptions were provided.

What HarmonyOS modules and error codes are covered?

The module mapping covers media (player, audio, camera, AVSession), ability runtime, location, telephony, Bluetooth, Wi-Fi, network management, ArkData stores, file management, WebView, NFC, ads, and security access token, keyed by error code prefixes, DOMAIN, .so libraries, and API names.

Why does Media Kit error 5400103 or 5400106 occur?

These errors typically indicate unsupported formats, corrupted or truncated media files, or IO failures. The Skill's media_file_analyzer.py validates the file's container structure, truncation, and format support to confirm or rule out file-level causes.

What are the limitations of this diagnostic approach?

Without hilogtool, binary logs fall back to gzip decoding which may contain garbled text. Terminal agents lack the CodeGenie document RAG and editor syntax checks, so they use web search and compiler-based fallbacks, which the report notes explicitly.