{"record":{"id":"8be082b126e6dfe3","repo":"mastra-ai/mastra","slug":"enoent-no-such-file-or-directory-path","errorCode":null,"errorMessage":"ENOENT: no such file or directory: ${path}","messagePattern":"ENOENT: no such file or directory: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/skills/inline-skill-source.ts","lineNumber":95,"sourceCode":"\n    // Root skill directory\n    if (subPath === '') return true;\n    // SKILL.md\n    if (subPath === 'SKILL.md') return true;\n    // references/ directory\n    if (subPath === 'references') return (skill.references?.length ?? 0) > 0;\n    // references/<file>\n    if (subPath.startsWith('references/')) {\n      const refPath = subPath.slice('references/'.length);\n      return skill.references.includes(refPath);\n    }\n    return false;\n  }\n\n  async stat(path: string): Promise<SkillSourceStat> {\n    const result = this.#getSkill(path);\n    if (!result) {\n      throw new Error(`ENOENT: no such file or directory: ${path}`);\n    }\n\n    const { skill, subPath } = result;\n    const now = new Date();\n\n    // Root skill directory\n    if (subPath === '') {\n      return { name: skill.name, type: 'directory', size: 0, createdAt: now, modifiedAt: now };\n    }\n    // SKILL.md\n    if (subPath === 'SKILL.md') {\n      const content = this.#skillMdCache.get(skill.name) ?? '';\n      return {\n        name: 'SKILL.md',\n        type: 'file',\n        size: Buffer.byteLength(content, 'utf-8'),\n        createdAt: now,\n        modifiedAt: now,","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/skills/inline-skill-source.ts#L77-L113","documentation":"InlineSkillSource emulates a filesystem over in-memory skill objects. stat() resolves the requested path via #getSkill; if the path does not resolve to a known inline skill (no matching skill entry), it throws this ENOENT-style error to mimic a missing file/directory. There is no real filesystem involved — only paths registered as inline skills exist.","triggerScenarios":"Calling source.stat(path) where path's skill prefix or skill name does not match any inline skill registered in the source (e.g. a typo'd skill name, or stat on a skill that was never added).","commonSituations":"Listing/copying skills by path derived from a different (file-based) skill source; skill names with case mismatches ('My-Skill' vs 'my-skill'); calling stat before the skill is registered, or after it was removed from the inline map.","solutions":["Verify the path matches an inline skill that was actually registered in this InlineSkillSource (correct prefix base and skill name).","Use readdir on the prefix base first to enumerate the valid skill names.","Check for case/typo differences in the skill name portion of the path.","Register the skill (e.g. via createSkill and adding it to the source) before stat-ing it."],"exampleFix":"// before\nawait source.stat('/inline-skills/my-skill'); // skill was named 'mySkill'\n// after\nawait source.stat('/inline-skills/mySkill');","handlingStrategy":"type-guard","validationCode":"const registeredSkills = await source.readdir('/inline-skills'); // or your prefix base\nconst names = new Set(registeredSkills.map((e) => e.name));\nfunction skillPathExists(path) {\n  const name = path.split('/').filter(Boolean).at(-1);\n  return names.has(name);\n}","typeGuard":"function isRegisteredSkillPath(path, knownSkillNames) {\n  const parts = path.split('/').filter(Boolean);\n  return parts.length >= 2 && knownSkillNames.includes(parts.at(-1));\n}","tryCatchPattern":"try {\n  const stat = await source.stat(path);\n} catch (e) {\n  if (String(e?.message).startsWith('ENOENT')) {\n    // treat as missing: skip, or fall back to listing valid skills\n    return null;\n  }\n  throw e;\n}","preventionTips":["Enumerate valid skill names via readdir before stat-ing specific paths.","Keep skill name casing consistent between registration and lookup.","Register skills before any code path that stats them (module init order)."],"tags":["skills","filesystem","not-found"],"backgroundTag":"file-not-found","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}