eyaltoledano/claude-task-master · error · TaskMasterError
VALIDATION_ERROR
VALIDATION_ERROR
Error message
Invalid brief ID or URL provided
What it means
exportFromBriefInput(briefInput) calls extractBriefId() to parse a brief ID or brief URL into a bare brief ID. If parsing fails (null/empty returned), it throws TaskMasterError with code VALIDATION_ERROR. This validates the shape of user-supplied input before any network call is made.
Source
Thrown at packages/tm-core/src/modules/integration/services/export.service.ts:488
taskCount: 0,
briefId,
orgId,
error: {
code: 'EXPORT_FAILED',
message: errorMessage
}
};
}
}
/**
* Export tasks from a brief ID or URL
*/
async exportFromBriefInput(briefInput: string): Promise<ExportResult> {
// Extract brief ID from input
const briefId = this.extractBriefId(briefInput);
if (!briefId) {
throw new TaskMasterError(
'Invalid brief ID or URL provided',
ERROR_CODES.VALIDATION_ERROR
);
}
// Fetch brief to get organization
const brief = await this.authManager.getBrief(briefId);
if (!brief) {
throw new TaskMasterError(
'Brief not found or you do not have access',
ERROR_CODES.NOT_FOUND
);
}
// Export with the resolved org and brief
return this.exportTasks({
orgId: brief.accountId,
briefId: brief.idView on GitHub (pinned to c0c98d367c)
Solutions
- Inspect the input string — confirm it is a brief ID or full brief URL from the correct domain.
- Pass the bare brief ID if the URL form is rejected (copy the ID segment from the URL).
- Trim whitespace and remove surrounding quotes before calling; check for shell-mangled characters.
- Pre-check with the same extraction logic (or a UUID/URL regex) before invoking the API.
Example fix
// before
await exportService.exportFromBriefInput(' https://app.example.com/briefs/b-123?tab=tasks ');
// after (trim and pass canonical form)
const input = rawInput.trim();
await exportService.exportFromBriefInput(input); // or just 'b-123' Defensive patterns
Strategy: validation
Validate before calling
function isValidBriefInput(input) {
if (typeof input !== 'string') return false;
const trimmed = input.trim();
// bare ID (non-empty, no spaces) or a URL containing a brief path segment
if (/^[\w-]+$/.test(trimmed)) return true;
try {
const url = new URL(trimmed);
return /\/briefs?\/[\w-]+/.test(url.pathname);
} catch {
return false;
}
}
if (!isValidBriefInput(rawInput)) throw new Error('Invalid brief ID or URL'); Type guard
function isBriefInput(v: unknown): v is string {
return typeof v === 'string' && v.trim().length > 0 &&
(/^[\w-]+$/.test(v.trim()) || /\/briefs?\/[\w-]+/.test(safeUrlPath(v)));
} Try / catch
try {
await exportService.exportFromBriefInput(input);
} catch (e) {
if (e instanceof TaskMasterError && e.code === ERROR_CODES.VALIDATION_ERROR) {
console.error(`'${input}' is not a valid brief ID or URL — pass e.g. b-123 or https://app.example.com/briefs/b-123`);
return;
}
throw e;
} Prevention
- Trim and de-quote user input before passing it to exportFromBriefInput()
- Prefer the bare brief ID over full URLs to avoid URL-format mismatches
- Copy IDs/URLs directly from the app instead of typing them
- Pre-validate with a regex/URL parse before making the call
When it happens
Trigger: Passing a string that is neither a valid brief ID nor a recognized brief URL format to exportFromBriefInput() — e.g. empty string, whitespace, a task ID, a malformed/truncated URL, or a URL from a different domain the extractor doesn't recognize.
Common situations: Copy-pasting a URL with extra query params or trailing characters the regex rejects; passing a local task ID instead of a brief ID; shell quoting strips characters; typos in a hand-typed brief ID.
Related errors
- MFA_VERIFICATION_FAILED
- Failed to initialize services: ${(error as Error).message}
- Invalid format: ${options.format}. Valid formats are: text,
- 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/586ad3ffc2965855.
Report an issue: GitHub.