eyaltoledano/claude-task-master · error
Empty file path provided
Error message
Empty file path provided
What it means
Thrown while parsing the --files option of commands that accept comma-separated file paths. After trimming, any empty token (e.g. from consecutive or trailing commas, or an empty option value) raises this error and aborts the command's file parsing.
Source
Thrown at scripts/modules/commands.js:2128
`Invalid task ID format: "${trimmedId}". Expected format: "15" or "15.2"`
);
}
return trimmedId;
});
} catch (error) {
console.error(chalk.red(`Error parsing task IDs: ${error.message}`));
process.exit(1);
}
}
// Validate and parse file paths if provided
let filePaths = [];
if (options.files) {
try {
filePaths = options.files.split(',').map((filePath) => {
const trimmedPath = filePath.trim();
if (trimmedPath.length === 0) {
throw new Error('Empty file path provided');
}
return trimmedPath;
});
} catch (error) {
console.error(
chalk.red(`Error parsing file paths: ${error.message}`)
);
process.exit(1);
}
}
// Validate save-to option if provided
if (options.saveTo) {
const saveToId = options.saveTo.trim();
if (saveToId.length === 0) {
console.error(chalk.red('Error: Save-to ID cannot be empty'));
process.exit(1);
}View on GitHub (pinned to c0c98d367c)
Solutions
- Remove empty entries between/trailing commas: --files=src/a.js,src/b.js.
- Guard scripts to omit --files entirely when the list is empty.
- Filter blank items before joining the comma-separated list.
- Check that the shell variable holding the file list is non-empty before invoking.
Example fix
// before --files=src/a.js,,src/b.js // after --files=src/a.js,src/b.js
Defensive patterns
Strategy: validation
Validate before calling
function parseFileList(filesOption) {
const list = filesOption.split(',').map(s => s.trim()).filter(Boolean);
if (list.length === 0) throw new Error('No valid file paths provided');
list.forEach(p => { if (!p) throw new Error('Empty file path provided'); });
return list;
} Type guard
const isNonEmptyPath = (s) => typeof s === 'string' && s.trim().length > 0;
Try / catch
try {
await runCommand({ files: options.files });
} catch (e) {
if (e.message === 'Empty file path provided') {
console.error(chalk.red('Fix --files: remove empty entries, e.g. --files=src/a.js,src/b.js'));
process.exit(1);
}
throw e;
} Prevention
- Filter out empty strings before joining file lists with commas.
- Omit --files entirely when the list is empty rather than passing a blank value.
- In scripts, default empty variables to skipping the flag.
When it happens
Trigger: Calling a CLI command with --files="" or --files=src/a.js,,src/b.js (empty token between commas) or --files=src/a.js, (trailing comma).
Common situations: Shell scripts assembling file lists where a variable is empty, hand-edited command lines leaving double commas, or automation piping a blank list into --files.
Related errors
- Invalid task ID format: "${trimmedId}". Expected format: "15
- MFA_VERIFICATION_FAILED
- streamObjectService requires a schema parameter
- Either existingTaskId or newSubtaskData must be provided
- ID_COUNT_MISMATCH
AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29).
Data as JSON: /api/errors/f5ee7a58b8fdd1cf.
Report an issue: GitHub.