eyaltoledano/claude-task-master · info
[WARN] Error updating state for migration notice: ${stateErr
Error message
[WARN] Error updating state for migration notice: ${stateError.message} What it means
markMigrationForNotice tries to read the state file and initialize migrationNoticeShown; if writing/updating that state file fails (stateError) the message is only printed when TASKMASTER_DEBUG=true. It indicates the .taskmaster/state.json could not be read or written, but the failure is swallowed by design so migrations don't break main flows.
Source
Thrown at scripts/modules/utils.js:964
const statePath = path.join(projectRoot, '.taskmaster', 'state.json');
// Ensure state.json exists
if (!fs.existsSync(statePath)) {
createStateJson(statePath);
}
// Read and update state to mark migration occurred using fs directly
try {
const rawState = fs.readFileSync(statePath, 'utf8');
const stateData = JSON.parse(rawState) || {};
// Only set to false if it's not already set (i.e., first time migration)
if (stateData.migrationNoticeShown === undefined) {
stateData.migrationNoticeShown = false;
fs.writeFileSync(statePath, JSON.stringify(stateData, null, 2), 'utf8');
}
} catch (stateError) {
if (process.env.TASKMASTER_DEBUG === 'true') {
console.warn(
`[WARN] Error updating state for migration notice: ${stateError.message}`
);
}
}
} catch (error) {
if (process.env.TASKMASTER_DEBUG === 'true') {
console.warn(
`[WARN] Error marking migration for notice: ${error.message}`
);
}
}
}
// Shared FileOperations instance for modifyJSON
let _fileOps = null;
/**
* Gets or creates the shared FileOperations instanceView on GitHub (pinned to c0c98d367c)
Solutions
- Fix filesystem permissions on .taskmaster/state.json (chown/chmod) so the process can write.
- Validate and repair state.json — it must be valid JSON; delete or fix a corrupted file.
- Create the .taskmaster directory if it is missing.
- If you need visibility, keep TASKMASTER_DEBUG=true and read the warning; otherwise it is safely ignorable.
- Check disk space / mount read-only flags in the execution environment.
Example fix
// before
// .taskmaster/state.json contains a trailing comma -> JSON.parse throws
// after
{ "migrationNoticeShown": false } // valid JSON, write succeeds Defensive patterns
Strategy: try-catch
Validate before calling
const statePath = path.join(projectRoot, '.taskmaster', 'state.json');
if (!fs.existsSync(path.dirname(statePath))) fs.mkdirSync(path.dirname(statePath), { recursive: true });
let stateData = {};
try { stateData = JSON.parse(fs.readFileSync(statePath, 'utf8')); }
catch { stateData = {}; } Try / catch
try {
markMigrationForNotice(projectRoot);
} catch (e) {
if (process.env.TASKMASTER_DEBUG === 'true') {
console.warn(`[WARN] migration notice state update failed: ${e.message}`);
}
// non-fatal: continue
} Prevention
- Keep .taskmaster writable by the running user.
- Never hand-edit state.json without validating JSON afterwards.
- Set TASKMASTER_DEBUG=true when diagnosing state issues.
- Check disk space and mount flags in containers/CI.
When it happens
Trigger: Any call path through markMigrationForNotice (addTask, readJSON) where fs.writeFileSync on the state file throws: read-only filesystem, missing .taskmaster directory, permission errors, malformed existing state.json causing JSON.parse to throw, or disk-full.
Common situations: Running in containers/CI with read-only mounts; state.json hand-edited into invalid JSON; ownership/permission issues after sudo usage; TASKMASTER_DEBUG enabled while the directory was deleted mid-run.
Related errors
AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29).
Data as JSON: /api/errors/50e1cec037f8c77e.
Report an issue: GitHub.