{"record":{"id":"e3ca3ea333b79797","repo":"eyaltoledano/claude-task-master","slug":"assets-directory-not-found-this-is-likely-a-packa","errorCode":null,"errorMessage":"Assets directory not found. This is likely a packaging issue.","messagePattern":"Assets directory not found\\. This is likely a packaging issue\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/utils/asset-resolver.js","lineNumber":54,"sourceCode":"\t\t\t'dist',\n\t\t\t'assets'\n\t\t),\n\t\tpath.join(process.cwd(), 'node_modules', 'task-master-ai', 'assets')\n\t];\n\n\t// Find the first existing assets directory\n\tfor (const assetPath of possiblePaths) {\n\t\tif (fs.existsSync(assetPath)) {\n\t\t\t// Verify it's actually the assets directory by checking for known files\n\t\t\tconst testFile = path.join(assetPath, 'rules', 'taskmaster.mdc');\n\t\t\tif (fs.existsSync(testFile)) {\n\t\t\t\treturn assetPath;\n\t\t\t}\n\t\t}\n\t}\n\n\t// If no assets directory found, throw an error\n\tthrow new Error(\n\t\t'Assets directory not found. This is likely a packaging issue.'\n\t);\n}\n\n/**\n * Get path to a specific asset file\n * @param {string} relativePath - Path relative to assets directory\n * @returns {string} Full path to the asset file\n */\nexport function getAssetPath(relativePath) {\n\tconst assetsDir = getAssetsDir();\n\treturn path.join(assetsDir, relativePath);\n}\n\n/**\n * Check if an asset file exists\n * @param {string} relativePath - Path relative to assets directory\n * @returns {boolean} True if the asset exists","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/src/utils/asset-resolver.js#L36-L72","documentation":"getAssetsDir walks known candidate locations to find the bundled assets directory (templates, examples, etc.). If none exist — typically because the package was installed or bundled without the assets/ folder — it throws this error. It exists to fail loudly instead of returning a bogus path that later fails with a confusing ENOENT.","triggerScenarios":"Calling getAssetsDir (or the assetsDir accessor) when no candidate assets directory resolves: package copied without assets/, npm pack/publish pruning files, bundlers (webpack/esbuild) not marking assets as external, installing from a repacked tarball, or global installs missing non-JS files.","commonSituations":"Distributing the CLI via a bundler and forgetting to copy assets; using pkg/nexe builds that skip non-JS resources; enterprise mirror/proxy stripping extra files; monorepo symlink installs where the relative lookup path changed after a build-layout refactor.","solutions":["Reinstall the package cleanly (npm cache clean; npm install) so the assets/ directory ships with node_modules","Verify the assets folder exists at the expected location relative to the package root; if missing, restore it from the repository","If bundling, copy assets/ into the output directory (e.g. esbuild --copy-files, webpack CopyPlugin) or mark the package as external","Check package.json 'files' field includes 'assets' so npm publishes it"],"exampleFix":"// package.json before\n\"files\": [\"index.js\"]\n// after\n\"files\": [\"index.js\", \"assets\"]","handlingStrategy":"fallback","validationCode":"const fs = require('fs');\nconst path = require('path');\nconst candidates = [\n  path.join(__dirname, 'assets'),\n  path.join(process.cwd(), 'node_modules', 'task-master-ai', 'assets')\n];\nconst assetsDir = candidates.find((p) => fs.existsSync(p));\nif (!assetsDir) throw new Error('Assets missing — reinstall the package');","typeGuard":null,"tryCatchPattern":"try {\n  const dir = getAssetsDir();\n} catch (err) {\n  if (err.message.includes('Assets directory not found')) {\n    console.error('Installation appears broken. Run: npm cache clean --force && npm install');\n    process.exitCode = 1;\n  } else throw err;\n}","preventionTips":["Keep package.json 'files' including the assets folder","Do not bundle the CLI without copying non-JS assets","Verify assets exist in CI before publishing (npm pack --dry-run)","Reinstall cleanly instead of copying partial node_modules between machines"],"tags":["packaging","assets","filesystem"],"backgroundTag":"missing-asset-packaging-issue","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}