home / skills / project-n-e-k-o / n.e.k.o / live2d-expression-404-triage
/.cursor/skills/live2d-expression-404-triage
This skill triages Live2D expression 404 errors by aligning EmotionMapping and FileReferences paths to ensure correct expression loading.
npx playbooks add skill project-n-e-k-o/n.e.k.o --skill live2d-expression-404-triageReview the files below or copy the command above to add this skill to your agents.
---
name: live2d-expression-404-triage
description: Diagnose and fix Live2D expression 404 errors caused by mismatch between EmotionMapping expression file paths and FileReferences.Expressions names. Use when logs show expressionXX.exp3.json 404, Failed to load expression, or temporary click effect expression playback failures.
---
# Live2D Expression 404 Triage
## Quick checks
1. Confirm error signature in console:
- `Failed to load resource ... expressionXX.exp3.json 404`
- `Failed to load expression: expressionXX.exp3.json`
2. Locate click/effect path:
- `static/live2d-interaction.js` in `_playTemporaryClickEffect`
- `static/live2d-emotion.js` in `playExpression`
3. Check whether code maps by strict equality only (`expr.File === choiceFile`).
## Root cause pattern
- `EmotionMapping.expressions` may contain basename only (for example `expression15.exp3.json`).
- `FileReferences.Expressions` often stores full relative path (for example `expressions/expression15.exp3.json`).
- Strict comparison fails, code falls back to inferred name, and runtime loads wrong path.
## Fix pattern
1. Add a shared resolver in `Live2DManager` (core file):
- Normalize paths (slash style, leading `./` or `/`, case).
- Match in two passes:
- exact normalized file path
- basename fallback
- Return `expr.Name` from `FileReferences.Expressions`.
2. Replace duplicated file->name conversion logic with this shared resolver.
3. If resolver returns null:
- avoid forcing native `currentModel.expression()` with guessed name;
- fall back to file-based/manual expression path when available.
## Regression checks
- Clicking model no longer triggers repeated expression 404 logs.
- Temporary click effects still recover after timeout.
- Persistent expression re-apply flow still runs.
- Existing models with full path mapping still behave the same.
This skill diagnoses and fixes Live2D expression 404 errors caused by mismatches between EmotionMapping expression entries and FileReferences.Expressions names. It provides a focused triage checklist, a resilient path resolver to unify basename and full-path mappings, and regression checks to confirm the fix. Use it to stop repeated expression 404s and restore reliable temporary click/effect playback.
The skill inspects console logs for 404 signatures and locates the playback sites in static/live2d-interaction.js and static/live2d-emotion.js. It detects strict-equality mapping failures where EmotionMapping contains basenames and FileReferences stores full relative paths. The remediation is a shared resolver in Live2DManager that normalizes paths and matches in two passes (exact normalized path, then basename fallback), returning the correct expression Name to avoid guessing and 404s.
What exact log lines confirm this issue?
Look for Failed to load resource ... expressionXX.exp3.json 404 and Failed to load expression: expressionXX.exp3.json in the console.
Why not just always use basename matching?
Basename-only matching hides real path issues and can cause incorrect fallback choices; the resolver first tries exact normalized path then falls back to basename to be both correct and tolerant.