{"record":{"id":"586ad3ffc2965855","repo":"eyaltoledano/claude-task-master","slug":"validation-error-586ad3","errorCode":"VALIDATION_ERROR","errorMessage":"Invalid brief ID or URL provided","messagePattern":"Invalid brief ID or URL provided","errorType":"error_code","errorClass":"TaskMasterError","httpStatus":null,"severity":"error","filePath":"packages/tm-core/src/modules/integration/services/export.service.ts","lineNumber":488,"sourceCode":"\t\t\t\ttaskCount: 0,\n\t\t\t\tbriefId,\n\t\t\t\torgId,\n\t\t\t\terror: {\n\t\t\t\t\tcode: 'EXPORT_FAILED',\n\t\t\t\t\tmessage: errorMessage\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t}\n\n\t/**\n\t * Export tasks from a brief ID or URL\n\t */\n\tasync exportFromBriefInput(briefInput: string): Promise<ExportResult> {\n\t\t// Extract brief ID from input\n\t\tconst briefId = this.extractBriefId(briefInput);\n\t\tif (!briefId) {\n\t\t\tthrow new TaskMasterError(\n\t\t\t\t'Invalid brief ID or URL provided',\n\t\t\t\tERROR_CODES.VALIDATION_ERROR\n\t\t\t);\n\t\t}\n\n\t\t// Fetch brief to get organization\n\t\tconst brief = await this.authManager.getBrief(briefId);\n\t\tif (!brief) {\n\t\t\tthrow new TaskMasterError(\n\t\t\t\t'Brief not found or you do not have access',\n\t\t\t\tERROR_CODES.NOT_FOUND\n\t\t\t);\n\t\t}\n\n\t\t// Export with the resolved org and brief\n\t\treturn this.exportTasks({\n\t\t\torgId: brief.accountId,\n\t\t\tbriefId: brief.id","sourceCodeStart":470,"sourceCodeEnd":506,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/packages/tm-core/src/modules/integration/services/export.service.ts#L470-L506","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nawait exportService.exportFromBriefInput('  https://app.example.com/briefs/b-123?tab=tasks ');\n// after (trim and pass canonical form)\nconst input = rawInput.trim();\nawait exportService.exportFromBriefInput(input); // or just 'b-123'","handlingStrategy":"validation","validationCode":"function isValidBriefInput(input) {\n  if (typeof input !== 'string') return false;\n  const trimmed = input.trim();\n  // bare ID (non-empty, no spaces) or a URL containing a brief path segment\n  if (/^[\\w-]+$/.test(trimmed)) return true;\n  try {\n    const url = new URL(trimmed);\n    return /\\/briefs?\\/[\\w-]+/.test(url.pathname);\n  } catch {\n    return false;\n  }\n}\nif (!isValidBriefInput(rawInput)) throw new Error('Invalid brief ID or URL');","typeGuard":"function isBriefInput(v: unknown): v is string {\n  return typeof v === 'string' && v.trim().length > 0 &&\n    (/^[\\w-]+$/.test(v.trim()) || /\\/briefs?\\/[\\w-]+/.test(safeUrlPath(v)));\n}","tryCatchPattern":"try {\n  await exportService.exportFromBriefInput(input);\n} catch (e) {\n  if (e instanceof TaskMasterError && e.code === ERROR_CODES.VALIDATION_ERROR) {\n    console.error(`'${input}' is not a valid brief ID or URL — pass e.g. b-123 or https://app.example.com/briefs/b-123`);\n    return;\n  }\n  throw e;\n}","preventionTips":["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"],"tags":["validation","export","input-parsing"],"backgroundTag":"invalid-input-format","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}