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

  1. Remove empty entries between/trailing commas: --files=src/a.js,src/b.js.
  2. Guard scripts to omit --files entirely when the list is empty.
  3. Filter blank items before joining the comma-separated list.
  4. 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

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


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