{"record":{"id":"a1cfe03c5ac611ac","repo":"moeru-ai/airi","slug":"cannot-find-file-path","errorCode":null,"errorMessage":"Cannot find file: ${path}","messagePattern":"Cannot find file: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/stage-ui-live2d/src/utils/live2d-zip-loader.ts","lineNumber":211,"sourceCode":"            '': motions.map(motion => ({ File: motion })),\n          }\n        : undefined,\n    },\n  })\n\n  settings.name = modelName\n\n  // provide this property for FileLoader\n  Object.assign(settings, { _objectURL: `example://${settings.url}` })\n\n  return settings\n}\n\nZipLoader.readText = async (jsZip: JSZip, path: string) => {\n  const file = jsZip.file(path)\n\n  if (!file) {\n    throw new Error(`Cannot find file: ${path}`)\n  }\n\n  const text = await file.async('text')\n\n  return isSettingsFile(path) ? sanitizeModelSettingsText(text) : text\n}\n\nconst defaultFileLoaderReadText = FileLoader.readText\nFileLoader.createSettings = async (files: File[]) => {\n  const settingsFile = files.find(file => isSettingsFile(file.webkitRelativePath || file.name))\n\n  if (!settingsFile) {\n    throw new TypeError('Settings file not found')\n  }\n\n  const settingsUrl = settingsFile.webkitRelativePath || settingsFile.name\n  const settingsText = await FileLoader.readText(settingsFile)\n  const settings = createModelSettings(settingsText, settingsUrl)","sourceCodeStart":193,"sourceCodeEnd":229,"githubUrl":"https://github.com/moeru-ai/airi/blob/9c213115f8bd0fff9e6eabab02b077ac32da21be/packages/stage-ui-live2d/src/utils/live2d-zip-loader.ts#L193-L229","documentation":"Thrown by the ZipLoader.readText override when jsZip.file(path) returns null, i.e. the settings file references a path that does not exist as an entry in the loaded archive. Note that settings get archive-path resolution (normalizeLive2DArchivePath via useArchivePathResolution), but after normalization the entry must still exist verbatim in the ZIP.","triggerScenarios":"A .model3.json whose FileReferences use Windows backslashes, URL-encoded characters (%20), './' prefixes, or different case than the actual ZIP entries; a settings JSON referencing textures/motions that were not packed into the archive; entries stored with a leading './' while settings omit it (or vice versa).","commonSituations":"Zipping on Windows producing different separators than the editor-exported references; archives where the model3.json sits at the root but references files with a prefix folder (or the reverse — zipping the folder vs its contents); hand-edited settings paths; case-sensitive matching failing on macOS-extracted then re-zipped files.","solutions":["Inspect the settings JSON and the ZIP entry list side by side; make referenced paths match entries exactly (separator '/', no './', correct case)","Re-zip so the .model3.json and its referenced files share the same root (zip the contents, not the wrapping folder, or vice versa to match references)","Avoid URL-encodable characters in file names inside model archives (spaces, #, %)","If you control generation, normalize references at build time to plain relative POSIX paths"],"exampleFix":"// before\n// model3.json contains \"FileReferences\": { \"Moc\": \"model.moc3\", \"Textures\": [\"tex (1).png\"] }\n// archive entries: 'tex_%20(1).png' -> Cannot find file: tex (1).png\n\n// after\n// rename archive entries to match the references exactly (no %20, matching case), or fix the references:\n\"Textures\": [\"tex_1.png\"]","handlingStrategy":"try-catch","validationCode":"const exists = (p: string) => Boolean(zip.file(p) ?? zip.file(p.replace(/^\\.\\//, '')))\nconst missing = referencedPaths.filter(p => !exists(p))\nif (missing.length) throw new Error(`Archive is missing referenced files: ${missing.join(', ')}`)","typeGuard":null,"tryCatchPattern":"catch (e) { if (e.message.startsWith('Cannot find file:')) { const p = e.message.slice('Cannot find file: '.length); suggestRepack(p); return } throw e }","preventionTips":["Keep archive entry paths byte-identical to settings references (case, separators, no './')","Avoid spaces/URL-encodable characters in model file names","Re-zip from the editor export without renaming"],"tags":["live2d","zip","path-resolution","missing-entry"],"backgroundTag":"live2d-model-load-failed","analyzedSha":"9c213115f8bd0fff9e6eabab02b077ac32da21be","analyzedAt":"2026-08-18T17:29:58.153Z","contentChangedAt":"2026-08-18T17:29:58.153Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}