eyaltoledano/claude-task-master · error
CONFIG_WRITE_ERROR
CONFIG_WRITE_ERROR
Error message
Error writing updated configuration to configuration file
What it means
setModel() validated the model, resolved the provider, and merged the new setting into the current config, but writeConfig() returned falsy when persisting the updated config object to the project's configuration file. The failure happened at the filesystem/persistence layer, so the model selection was NOT saved.
Source
Thrown at scripts/modules/task-manager/models.js:748
) {
currentConfig.models[role].baseURL = computedBaseURL;
} else {
// Remove baseURL when switching to a provider that doesn't need it
delete currentConfig.models[role].baseURL;
}
// If model data is available, update maxTokens from supported-models.json
if (modelData && modelData.max_tokens) {
currentConfig.models[role].maxTokens = modelData.max_tokens;
}
// Write updated configuration
const writeResult = writeConfig(currentConfig, projectRoot);
if (!writeResult) {
return {
success: false,
error: {
code: 'CONFIG_WRITE_ERROR',
message: 'Error writing updated configuration to configuration file'
}
};
}
const successMessage = `Successfully set ${role} model to ${modelId} (Provider: ${determinedProvider})`;
report('info', successMessage);
return {
success: true,
data: {
role,
provider: determinedProvider,
modelId,
message: successMessage,
warning: warningMessage // Include warning in the response data
}
};View on GitHub (pinned to c0c98d367c)
Solutions
- Check file/dir permissions on .taskmaster/config.json (`ls -la .taskmaster/`) and fix ownership (sudo chown $(whoami) .taskmaster/config.json).
- Confirm the project root is correct and the config file exists (`task-master models` to read current config); run `task-master init` if the directory is missing.
- Free disk space / raise quota if the filesystem is full, then retry the set command.
- If running in a read-only environment (Docker/CI), mount the workspace writable or run the command locally where the filesystem allows writes.
Example fix
// before $ task-master models --set-main --openrouter anthropic/claude-sonnet-4 // CONFIG_WRITE_ERROR // after $ sudo chown -R $(whoami) .taskmaster $ chmod u+w .taskmaster/config.json $ task-master models --set-main --openrouter anthropic/claude-sonnet-4
Defensive patterns
Strategy: validation
Validate before calling
const fs = require('fs');
const path = require('path');
const cfgPath = path.join(projectRoot, '.taskmaster', 'config.json');
fs.accessSync(path.dirname(cfgPath), fs.constants.W_OK); // dir writable?
if (fs.existsSync(cfgPath)) fs.accessSync(cfgPath, fs.constants.W_OK); // file writable?
// only then call setModel(...) Try / catch
const res = await setModel(modelId, role, projectRoot, options);
if (!res.success && res.error?.code === 'CONFIG_WRITE_ERROR') {
console.error(`Cannot write config at ${projectRoot}/.taskmaster — check permissions, disk space, and read-only mounts`);
process.exitCode = 1;
} Prevention
- Ensure the process user owns .taskmaster/config.json (avoid sudo-created config files).
- Don't run model-setting commands against read-only mounts (CI checkouts, some Docker volumes).
- Monitor disk space/quota in CI environments where the command runs unattended.
- Back up config.json before scripted batch changes so a failed write is recoverable.
When it happens
Trigger: writeConfig(currentConfig, projectRoot) fails — typically because .taskmaster/config.json (or the resolved config path) is unwritable: read-only filesystem, permission denied, missing parent directory, disk full, or the file is locked by another process.
Common situations: Running inside a Docker container or CI with a read-only checkout; config file owned by root after a sudo install; restricted sandboxed editor shells; disk quota exceeded; project root misdetected so writeConfig targets a non-existent directory.
Related errors
- WRITE_ERROR
- CONFIG_ERROR
- Failed to read file ${filePath}: ${error.message}
- Failed to read ${filePath} for modification: ${err.message}
- Failed to create directory ${dirPath}: ${error.message}
AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29).
Data as JSON: /api/errors/56cc6f6871a6e658.
Report an issue: GitHub.