eyaltoledano/claude-task-master · error · TaskMasterError

VALIDATION_ERROR

VALIDATION_ERROR

Error message

'Organization slug could not be extracted from input'

What it means

BriefUrlParser.validate throws this when options.requireOrg is set but the parsed input has no orgSlug. It is an input-validation guard ensuring a brief URL/string contained a usable organization slug before downstream resolution proceeds.

Source

Thrown at packages/tm-core/src/modules/briefs/utils/url-parser.ts:139

		}

		return { orgSlug, briefId };
	}

	/**
	 * Validate that required components are present
	 *
	 * @param parsed - Parsed URL components
	 * @param requireOrg - Whether org slug is required
	 * @param requireBrief - Whether brief ID is required
	 * @throws TaskMasterError if required components are missing
	 */
	static validate(
		parsed: ParsedBriefUrl,
		options: { requireOrg?: boolean; requireBrief?: boolean } = {}
	): void {
		if (options.requireOrg && !parsed.orgSlug) {
			throw new TaskMasterError(
				'Organization slug could not be extracted from input',
				ERROR_CODES.VALIDATION_ERROR
			);
		}

		if (options.requireBrief && !parsed.briefId) {
			throw new TaskMasterError(
				'Brief identifier could not be extracted from input',
				ERROR_CODES.VALIDATION_ERROR
			);
		}
	}
}

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Provide the full brief URL including the organization slug (e.g. https://host/org-slug/brief/123)
  2. If the input legitimately has no org, call validate without requireOrg and supply the org separately from context
  3. Inspect the parsed object first (parsed.orgSlug) before requesting validation
  4. Normalize the input string (trim, correct host) before parsing

Example fix

// before
const parsed = BriefUrlParser.parse('https://host/brief/123');
BriefUrlParser.validate(parsed, { requireOrg: true }); // throws
// after
const parsed = BriefUrlParser.parse('https://host/acme/brief/123'); // full URL with org
BriefUrlParser.validate(parsed, { requireOrg: true });
Defensive patterns

Strategy: validation

Validate before calling

const parsed = BriefUrlParser.parse(input);
if (!parsed.orgSlug) {
  throw new Error('Input must be a full brief URL containing the organization slug');
}
BriefUrlParser.validate(parsed, { requireOrg: true }); // now safe

Type guard

function hasOrgSlug(p: ParsedBriefUrl): p is ParsedBriefUrl & { orgSlug: string } {
  return typeof p.orgSlug === 'string' && p.orgSlug.length > 0;
}

Try / catch

try {
  BriefUrlParser.validate(parsed, { requireOrg: true });
} catch (e) {
  if (e instanceof TaskMasterError && e.code === 'VALIDATION_ERROR') {
    // ask user for the full URL or fall back to org from `tm context org`
  } else { throw e; }
}

Prevention

When it happens

Trigger: Calling BriefUrlParser.validate(parsed, { requireOrg: true }) with a ParsedBriefUrl whose orgSlug is null/empty — e.g. parsing a bare brief ID or a URL without an org segment.

Common situations: User pastes only a brief path/ID instead of the full URL; internal URLs omit the org segment; regex/parse produced empty orgSlug for an unusual URL shape; caller requires org but input was a bare ID.

Related errors


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