eyaltoledano/claude-task-master · error

API_KEY_STATUS_ERROR

API_KEY_STATUS_ERROR

Error message

${error.message}

What it means

Catch-all wrapper in getApiKeyStatusReport(): any unexpected exception while building the per-provider API key status report is returned under API_KEY_STATUS_ERROR with the underlying error's message. getApiKeyStatusReport inspects config and environment for each supported provider, so failures usually come from reading config or probing environment variables.

Solutions

  1. Check the wrapped error.message for the root cause and validate .taskmaster/config.json parses as JSON.
  2. Run from the project root (or pass the correct projectRoot) so the config file is found.
  3. Restore a clean config with `task-master init` (back up the old one first) and re-run `task-master models --status`.
  4. Update task-master; if the crash is in library code, file an issue with the error message.

Example fix

// before
const status = await getApiKeyStatusReport(); // throws: 'Unexpected token } in JSON'
// after
const raw = JSON.parse(fs.readFileSync('.taskmaster/config.json', 'utf8')); // fix file first
const status = await getApiKeyStatusReport();
Defensive patterns

Strategy: try-catch

Validate before calling

const fs = require('fs');
if (!fs.existsSync('.taskmaster/config.json')) throw new Error('Run task-master init first');
JSON.parse(fs.readFileSync('.taskmaster/config.json', 'utf8')); // throws early on corrupt config

Try / catch

try {
  const res = await getApiKeyStatusReport(projectRoot);
  if (!res.success && res.error?.code === 'API_KEY_STATUS_ERROR') {
    console.error(`Key status check failed: ${res.error.message}`);
  }
} catch (e) {
  console.error('Unhandled API key status failure:', e.message);
}

Prevention

When it happens

Trigger: Calling getApiKeyStatusReport() (via apiKeyStatusResult) when getConfig() throws on malformed config JSON, an fs error occurs reading the config file, or a provider-status helper throws on unexpected environment/config shapes.

Common situations: Corrupted or hand-edited .taskmaster/config.json; wrong working directory so projectRoot detection fails; environment with restricted access to process.env or an fs permission error; partially upgraded config missing expected keys.

Related errors


AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29). Data as JSON: /api/errors/e36cdb21070a9299. Report an issue: GitHub.

Appendix: source

Thrown at scripts/modules/task-manager/models.js:824

				cli: cliOk,
				mcp: mcpOk
			};
		});

		report('info', 'Successfully generated API key status report.');
		return {
			success: true,
			data: {
				report: statusReport,
				message: 'API key status report generated.'
			}
		};
	} catch (error) {
		report('error', `Error generating API key status report: ${error.message}`);
		return {
			success: false,
			error: {
				code: 'API_KEY_STATUS_ERROR',
				message: error.message
			}
		};
	}
}

export {
	getModelConfiguration,
	getAvailableModelsList,
	setModel,
	getApiKeyStatusReport
};

View on GitHub (pinned to c0c98d367c)