eyaltoledano/claude-task-master · error
storeTasksInGit must be a boolean
Error message
storeTasksInGit must be a boolean
What it means
validateInputs requires storeTasksInGit to be a strict boolean because it decides whether task files are ignored or committed. Non-boolean truthy/falsy values (strings 'true'/'false', 0/1, undefined) are rejected to avoid ambiguous behavior in the generated .gitignore rules.
Source
Thrown at src/utils/manage-gitignore.js:161
* @param {string} content - Template content
* @param {boolean} storeTasksInGit - Storage preference
* @throws {Error} If validation fails
*/
function validateInputs(targetPath, content, storeTasksInGit) {
if (!targetPath || typeof targetPath !== 'string') {
throw new Error('targetPath must be a non-empty string');
}
if (!targetPath.endsWith('.gitignore')) {
throw new Error('targetPath must end with .gitignore');
}
if (!content || typeof content !== 'string') {
throw new Error('content must be a non-empty string');
}
if (typeof storeTasksInGit !== 'boolean') {
throw new Error('storeTasksInGit must be a boolean');
}
}
/**
* Creates a new .gitignore file from template
* @param {string} targetPath - Path to create file at
* @param {string[]} templateLines - Adjusted template lines
* @param {function} log - Logging function
*/
function createNewGitignoreFile(targetPath, templateLines, log) {
try {
fs.writeFileSync(targetPath, templateLines.join('\n') + '\n');
if (typeof log === 'function') {
log('success', `Created ${targetPath} with full template`);
}
} catch (error) {
if (typeof log === 'function') {
log('error', `Failed to create ${targetPath}: ${error.message}`);View on GitHub (pinned to c0c98d367c)
Solutions
- Pass a real boolean: manageGitignoreFile(p, content, storeTasksInGit === true)
- Coerce env/CLI strings explicitly: const flag = process.env.TM_STORE_TASKS === 'true'
- Ensure the CLI/config layer parses the option with a boolean type (Commander .boolean option, JSON schema default false)
Example fix
// before const store = process.env.STORE_TASKS_IN_GIT; // 'true' string manageGitignoreFile(p, content, store); // after const store = process.env.STORE_TASKS_IN_GIT === 'true'; manageGitignoreFile(p, content, store);
Defensive patterns
Strategy: type-guard
Validate before calling
if (typeof storeTasksInGit !== 'boolean') {
storeTasksInGit = storeTasksInGit === 'true' || storeTasksInGit === 1;
} Type guard
const isBoolean = (v) => typeof v === 'boolean';
Try / catch
try {
manageGitignoreFile(targetPath, content, storeTasksInGit);
} catch (err) {
if (err.message === 'storeTasksInGit must be a boolean') {
manageGitignoreFile(targetPath, content, Boolean(storeTasksInGit) && storeTasksInGit !== 'false');
} else throw err;
} Prevention
- Coerce env vars and CLI strings to booleans explicitly (=== 'true')
- Declare the CLI option as a boolean type in the argument parser
- Give config schemas a boolean type with a default of false
- Never forward raw env/config values into typed API parameters
When it happens
Trigger: Calling manageGitignoreFile where the fourth argument is undefined (option not provided), a CLI string flag ('true'/'false' from process.argv or env), or a numeric 0/1.
Common situations: Reading the preference from a JSON/env layer that yields strings; forgetting to pass the argument in a programmatic call; CLI parsing that does not coerce --store-tasks to a real boolean.
Understand the failure class
Background: Invalid argument type errors: "must be of type string", "expected X, got Y", and ERR_INVALID_ARG_TYPE explained — this error's family across 15 libraries.
Related errors
- targetPath must be a non-empty string
- targetPath must end with .gitignore
- content must be a non-empty string
- Failed to fetch tasks from any tag. First error: ${failedTag
- ${authCheck.error}
AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29).
Data as JSON: /api/errors/c280489e177c07a9.
Report an issue: GitHub.