continuedev/continue · error · Error
Unknown URI type: ${(identifier as any).uriType}
Error message
Unknown URI type: ${(identifier as any).uriType} What it means
encodePackageIdentifier received a PackageIdentifier whose uriType is neither 'slug' nor 'file'. The function switches on uriType to decide encoding strategy and rejects anything unrecognized, typically indicating a malformed or incompletely constructed identifier object.
Source
Thrown at packages/config-yaml/src/interfaces/slugs.ts:94
export function packageIdentifierToDisplayName(id: PackageIdentifier): string {
switch (id.uriType) {
case "file":
return id.fileUri;
case "slug":
return id.fullSlug.packageSlug;
}
}
export function encodePackageIdentifier(identifier: PackageIdentifier): string {
switch (identifier.uriType) {
case "slug":
return encodeFullSlug(identifier.fullSlug);
case "file":
// For file paths, just return the path directly without a prefix
return identifier.fileUri;
default:
throw new Error(`Unknown URI type: ${(identifier as any).uriType}`);
}
}
export function decodePackageIdentifier(identifier: string): PackageIdentifier {
// Shorthand: if it starts with . or /, then it's a path
if (identifier.startsWith(".") || identifier.startsWith("/")) {
return {
uriType: "file",
fileUri: identifier,
};
}
// Keep support for explicit file:// protocol
else if (identifier.startsWith("file://")) {
return {
uriType: "file",
fileUri: identifier.substring(7),
};
}View on GitHub (pinned to 5522c6f44c)
Solutions
- Check the value of identifier.uriType at the call site and correct it to 'slug' or 'file'
- If constructing identifiers programmatically, use a helper/factory that sets uriType from a literal type
- Add a type guard before calling to narrow to known variants
Example fix
// before
encodePackageIdentifier({ uriType: 'file-uri', fileUri: '/tmp/x' } as any);
// after
encodePackageIdentifier({ uriType: 'file', fileUri: '/tmp/x' }); Defensive patterns
Strategy: type-guard
Type guard
function isPackageIdentifier(id: unknown): id is PackageIdentifier {
const v = id as any;
return (
(v?.uriType === 'file' && typeof v?.fileUri === 'string') ||
(v?.uriType === 'slug' && !!v?.fullSlug?.ownerSlug && !!v?.fullSlug?.packageSlug)
);
} Prevention
- Never construct identifiers via `as any`
- Keep uriType values as literal types
- Validate identifiers at system boundaries (deserialize + guard)
When it happens
Trigger: Calling encodePackageIdentifier({uriType: 'registry'} as any) or passing an object where uriType is missing/misspelled (e.g. 'Slug', 'file-uri').
Common situations: Constructing PackageIdentifier literals by hand, drift after a type rename in an upgrade, or data crossing a serialization boundary that drops the uriType field.
Related errors
- Unknown package identifier type: ${(id as any).uriType}
- Invalid FQSN format: package slug must have two parts
- Invalid assistant identifier: ${options.assistant}. Expected
- Table name must be in format schema.table_name, got ${tableN
- Only rule files can be deleted
AI-assisted analysis of continuedev/continue@5522c6f44c (2026-08-27).
Data as JSON: /api/errors/d8c20183695c40fa.
Report an issue: GitHub.