{"record":{"id":"d8c20183695c40fa","repo":"continuedev/continue","slug":"unknown-uri-type-identifier-as-any-uritype","errorCode":null,"errorMessage":"Unknown URI type: ${(identifier as any).uriType}","messagePattern":"Unknown URI type: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/config-yaml/src/interfaces/slugs.ts","lineNumber":94,"sourceCode":"\nexport function packageIdentifierToDisplayName(id: PackageIdentifier): string {\n  switch (id.uriType) {\n    case \"file\":\n      return id.fileUri;\n    case \"slug\":\n      return id.fullSlug.packageSlug;\n  }\n}\n\nexport function encodePackageIdentifier(identifier: PackageIdentifier): string {\n  switch (identifier.uriType) {\n    case \"slug\":\n      return encodeFullSlug(identifier.fullSlug);\n    case \"file\":\n      // For file paths, just return the path directly without a prefix\n      return identifier.fileUri;\n    default:\n      throw new Error(`Unknown URI type: ${(identifier as any).uriType}`);\n  }\n}\n\nexport function decodePackageIdentifier(identifier: string): PackageIdentifier {\n  // Shorthand: if it starts with . or /, then it's a path\n  if (identifier.startsWith(\".\") || identifier.startsWith(\"/\")) {\n    return {\n      uriType: \"file\",\n      fileUri: identifier,\n    };\n  }\n  // Keep support for explicit file:// protocol\n  else if (identifier.startsWith(\"file://\")) {\n    return {\n      uriType: \"file\",\n      fileUri: identifier.substring(7),\n    };\n  }","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/continuedev/continue/blob/5522c6f44ca0ac3528b37244818fbfa39b5af470/packages/config-yaml/src/interfaces/slugs.ts#L76-L112","documentation":"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.","triggerScenarios":"Calling encodePackageIdentifier({uriType: 'registry'} as any) or passing an object where uriType is missing/misspelled (e.g. 'Slug', 'file-uri').","commonSituations":"Constructing PackageIdentifier literals by hand, drift after a type rename in an upgrade, or data crossing a serialization boundary that drops the uriType field.","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"],"exampleFix":"// before\nencodePackageIdentifier({ uriType: 'file-uri', fileUri: '/tmp/x' } as any);\n// after\nencodePackageIdentifier({ uriType: 'file', fileUri: '/tmp/x' });","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"function isPackageIdentifier(id: unknown): id is PackageIdentifier {\n  const v = id as any;\n  return (\n    (v?.uriType === 'file' && typeof v?.fileUri === 'string') ||\n    (v?.uriType === 'slug' && !!v?.fullSlug?.ownerSlug && !!v?.fullSlug?.packageSlug)\n  );\n}","tryCatchPattern":null,"preventionTips":["Never construct identifiers via `as any`","Keep uriType values as literal types","Validate identifiers at system boundaries (deserialize + guard)"],"tags":["validation","slug","identifier","typescript"],"backgroundTag":"invalid-discriminated-union","analyzedSha":"5522c6f44ca0ac3528b37244818fbfa39b5af470","analyzedAt":"2026-08-27T11:28:54.683Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}