eyaltoledano/claude-task-master · error
Could not create directory for ${pathType}: ${parentDir}. Er
Error message
Could not create directory for ${pathType}: ${parentDir}. Error: ${error.message} What it means
resolvePath() creates the parent directory for output-type path overrides using fs.mkdirSync(recursive: true). If the OS-level mkdir fails (permissions, read-only filesystem, existing non-directory file at that path, EACCES/ENOSPC, etc.), the underlying error is wrapped in this message that includes the path type, the target directory, and the original error message. The thrown error is a wrapper — the cause is in the interpolated error.message.
Source
Thrown at src/task-master.js:182
pathType,
override,
defaultPaths = [],
basePath = null,
createParentDirs = false
) => {
if (typeof override === 'string') {
const resolvedPath = path.isAbsolute(override)
? override
: path.resolve(basePath || process.cwd(), override);
if (createParentDirs) {
// For output paths, create parent directory if it doesn't exist
const parentDir = path.dirname(resolvedPath);
if (!fs.existsSync(parentDir)) {
try {
fs.mkdirSync(parentDir, { recursive: true });
} catch (error) {
throw new Error(
`Could not create directory for ${pathType}: ${parentDir}. Error: ${error.message}`
);
}
}
} else {
// Original validation logic
if (!fs.existsSync(resolvedPath)) {
throw new Error(
`${pathType} override path does not exist: ${resolvedPath}`
);
}
}
return resolvedPath;
}
if (override === true) {
// Required path - search defaults and fail if not found
for (const defaultPath of defaultPaths) {View on GitHub (pinned to c0c98d367c)
Solutions
- Read the embedded Error: message at the end of the string (EACCES, ENOTDIR, ENOSPC) and address that cause.
- Create the directory manually (mkdir -p <parentDir>) and confirm it succeeds; fix permissions with chmod/chown if needed.
- Point the override at a writable location, e.g. a path under the project root or user home.
- Check that nothing (a regular file) already occupies the parent directory path.
Example fix
// before --output /var/restricted/out/tasks.json // EACCES // after mkdir -p ./reports && task-master --output ./reports/tasks.json
Defensive patterns
Strategy: try-catch
Validate before calling
const parentDir = path.dirname(path.resolve(outputPath));
if (!fs.existsSync(parentDir)) {
fs.accessSync(path.dirname(parentDir), fs.constants.W_OK); // throws early with a clearer errno
}
Try / catch
try {
paths.output = tm.resolvePath({ output: userOutputPath });
} catch (err) {
if (err.message.startsWith('Could not create directory')) {
console.error(err.message); // includes underlying fs error + parent dir
const fallback = path.join(process.cwd(), 'reports');
fs.mkdirSync(fallback, { recursive: true });
paths.output = fallback;
} else {
throw err;
}
} Prevention
- Pre-create output directories in setup scripts (mkdir -p) before running taskmaster.
- Point output overrides at project-relative or home-relative writable paths.
- Avoid system paths (/var, /etc, /proc) as output destinations.
- In containers, mount a writable volume and use it for outputs.
- Parse the trailing fs error (EACCES/ENOSPC/ENOTDIR) from the message to diagnose quickly.
When it happens
Trigger: An output override path whose parent directory cannot be created: e.g. overrides.output = '/root/reports/tasks.json' without root permission; a regular file already exists at the parent path so mkdir fails with ENOTDIR/EEXIST; disk full or read-only mount.
Common situations: Running taskmaster in containers where the target volume is read-only; using home-relative paths as a different user (sudo vs user); typos making the path land in a restricted location like /system/... on Windows or /proc/... on Linux.
Related errors
- Failed to read file ${filePath}: ${error.message}
- Failed to read ${filePath} for modification: ${err.message}
- Failed to get brief creation URL
- CONFIG_ERROR
- Failed to create directory ${dirPath}: ${error.message}
AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29).
Data as JSON: /api/errors/ccf6871b1a04a0d9.
Report an issue: GitHub.