continuedev/continue · error · Error
Unknown package identifier type: ${(id as any).uriType}
Error message
Unknown package identifier type: ${(id as any).uriType} What it means
RegistryClient.getContent hit the default switch branch: the identifier's uriType is neither 'file' nor 'slug', indicating a malformed or future/unknown identifier type.
Source
Thrown at packages/config-yaml/src/registryClient.ts:29
private readonly rootPath?: string;
constructor(options: RegistryClientOptions = {}) {
this.rootPath = options.rootPath;
}
async getContent(id: PackageIdentifier): Promise<string> {
// Return pre-read content if available (for vscode-remote:// URIs in WSL)
if (id.uriType === "file" && id.content !== undefined) {
return id.content;
}
switch (id.uriType) {
case "file":
return this.getContentFromFilePath(id.fileUri);
case "slug":
throw new Error("Slug-based package resolution is not supported");
default:
throw new Error(
`Unknown package identifier type: ${(id as any).uriType}`,
);
}
}
private getContentFromFilePath(filepath: string): string {
if (filepath.startsWith("file://")) {
// For Windows file:///C:/path/to/file, we need to handle it properly
// On other systems, we might have file:///path/to/file
return fs.readFileSync(new URL(filepath), "utf8");
} else if (path.isAbsolute(filepath)) {
return fs.readFileSync(filepath, "utf8");
} else {
// Try to resolve relative to current working directory first
const resolvedPath = path.resolve(filepath);
if (fs.existsSync(resolvedPath)) {
return fs.readFileSync(resolvedPath, "utf8");
}View on GitHub (pinned to 5522c6f44c)
Solutions
- Inspect id.uriType and set it to 'file' or 'slug'
- Build identifiers with typed factory functions
- Add a type guard before calling getContent
Defensive patterns
Strategy: type-guard
Type guard
function isKnownIdentifier(id: unknown): id is PackageIdentifier {
const t = (id as any)?.uriType;
return t === 'file' || t === 'slug';
} Try / catch
try { await registry.getContent(id); } catch (e) { if (e.message.includes('Unknown package identifier type')) { /* log id.uriType for debugging */ } } Prevention
- Construct identifiers via typed helpers
- Validate deserialized identifiers before use
When it happens
Trigger: getContent({uriType: 'http'} as any) or an identifier deserialized with a missing/corrupted uriType.
Common situations: Type assertions bypassing the union, version skew where one side defines new uriType values, or JSON round-tripping dropping the field.
Related errors
- Unknown URI type: ${(identifier as any).uriType}
- Invalid assistant identifier: ${options.assistant}. Expected
- Table name must be in format schema.table_name, got ${tableN
- Only rule files can be deleted
- FindAndReplaceMissingOldString
AI-assisted analysis of continuedev/continue@5522c6f44c (2026-08-27).
Data as JSON: /api/errors/c2d45053921a6f3c.
Report an issue: GitHub.