eyaltoledano/claude-task-master · critical
INITIALIZATION_FAILED
INITIALIZATION_FAILED
Error message
Core project initialization failed: ${error.message} What it means
Wrapper error for initializeProjectDirect: the core initializeProject routine threw mid-initialization, so the tool records INITIALIZATION_FAILED with the underlying message and attaches error.stack in details, marks success=false, and disables silent mode in finally. The project may be left partially initialized.
Source
Thrown at mcp-server/src/core/direct-functions/initialize-project.js:103
}
log.info(`Initializing project with options: ${JSON.stringify(options)}`);
const result = await initializeProject(options); // Call core logic
resultData = {
message: 'Project initialized successfully.',
next_step:
'Now that the project is initialized, the next step is to create the tasks by parsing a PRD. This will create the tasks folder and the initial task files (tasks folder will be created when parse-prd is run). The parse-prd tool will require a prd.txt file as input (typically found in .taskmaster/docs/ directory). You can create a prd.txt file by asking the user about their idea, and then using the .taskmaster/templates/example_prd.txt file as a template to generate a prd.txt file in .taskmaster/docs/. You may skip all of this if the user already has a prd.txt file. You can THEN use the parse-prd tool to create the tasks. So: step 1 after initialization is to create a prd.txt file in .taskmaster/docs/prd.txt or confirm the user already has one. Step 2 is to use the parse-prd tool to create the tasks. Do not bother looking for tasks after initialization, just use the parse-prd tool to create the tasks after creating a prd.txt from which to parse the tasks. You do NOT need to reinitialize the project to parse-prd.',
...result
};
success = true;
log.info(
`Project initialization completed successfully in ${targetDirectory}.`
);
} catch (error) {
log.error(`Core initializeProject failed: ${error.message}`);
errorResult = {
code: 'INITIALIZATION_FAILED',
message: `Core project initialization failed: ${error.message}`,
details: error.stack
};
success = false;
} finally {
disableSilentMode();
log.info(`Restoring original CWD: ${originalCwd}`);
process.chdir(originalCwd);
}
if (success) {
return { success: true, data: resultData };
} else {
return { success: false, error: errorResult };
}
}
View on GitHub (pinned to c0c98d367c)
Solutions
- Inspect details (error.stack) in the response and the server log 'Core initializeProject failed: ...' for the exact failing step
- Fix filesystem permissions on the target directory and retry
- Remove or back up a partially created .taskmaster directory, then re-run initialize_project
- Run task-master init via CLI in the same directory to surface the interactive error directly
Example fix
// before
await mcp.call('initialize_project', { projectRoot: '/mnt/readonly' });
// after
fs.accessSync('/mnt/readonly', fs.constants.W_OK); // fail fast with a clear message
await mcp.call('initialize_project', { projectRoot: '/mnt/readonly' }); Defensive patterns
Strategy: try-catch
Validate before calling
import fs from 'fs';
const root = '/target/project';
fs.accessSync(root, fs.constants.W_OK); // writable
const tmDir = `${root}/.taskmaster`;
if (fs.existsSync(tmDir)) console.warn('Existing .taskmaster found; back it up before re-initializing'); Type guard
function isInitializationFailed(res) {
return res && res.success === false && res.error?.code === 'INITIALIZATION_FAILED';
} Try / catch
const res = await callTool('initialize_project', { projectRoot });
if (!res.success && res.error?.code === 'INITIALIZATION_FAILED') {
console.error('Init failed:', res.error.message);
if (res.error.details) console.error('Stack:', res.error.details); // details carries error.stack
// clean up partial scaffolding, then retry
} Prevention
- Check disk space and write permissions before initializing
- Back up or clear existing .taskmaster directories before re-init
- Read res.error.details — it contains the full stack of the core failure
- If MCP sandboxing blocks git/file writes, prefer the CLI init in that environment
When it happens
Trigger: Core initializeProject fails during scaffolding: template copy errors, directory permission denied, file-write failures, git init problems, or interactive prompts hitting non-TTY contexts.
Common situations: Read-only or root-owned target directory; existing .taskmaster content conflicting with templates; disk-full; running the MCP server in a sandbox that blocks git or file writes.
Related errors
AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29).
Data as JSON: /api/errors/f9d32ba62f7c3fad.
Report an issue: GitHub.