{"record":{"id":"9077b3b431771669","repo":"CopilotKit/CopilotKit","slug":"message-9077b3","errorCode":null,"errorMessage":"${message}","messagePattern":"\\$\\{message\\}","errorType":"http","errorClass":"CopilotKitApiDiscoveryError","httpStatus":400,"severity":"error","filePath":"packages/shared/src/utils/errors.ts","lineNumber":409,"sourceCode":"export class ResolvedCopilotKitError extends CopilotKitError {\n  constructor({\n    status,\n    message,\n    code,\n    isRemoteEndpoint,\n    url,\n  }: {\n    status: number;\n    message?: string;\n    code?: CopilotKitErrorCode;\n    isRemoteEndpoint?: boolean;\n    url?: string;\n  }) {\n    let resolvedCode = code;\n    if (!resolvedCode) {\n      switch (status) {\n        case 400:\n          throw new CopilotKitApiDiscoveryError({ message, url });\n        case 404:\n          throw isRemoteEndpoint\n            ? new CopilotKitRemoteEndpointDiscoveryError({ message, url })\n            : new CopilotKitApiDiscoveryError({ message, url });\n        default:\n          resolvedCode = CopilotKitErrorCode.UNKNOWN;\n          break;\n      }\n    }\n\n    super({ message, code: resolvedCode });\n    this.name = ERROR_NAMES.RESOLVED_COPILOT_KIT_ERROR;\n  }\n}\n\nexport class ConfigurationError extends CopilotKitError {\n  constructor(message: string) {\n    super({ message, code: CopilotKitErrorCode.CONFIGURATION_ERROR });","sourceCodeStart":391,"sourceCodeEnd":427,"githubUrl":"https://github.com/CopilotKit/CopilotKit/blob/68fbe97d87420bd84e8196965c71bd6e394a3f7a/packages/shared/src/utils/errors.ts#L391-L427","documentation":"This is the constructor dispatch of a CopilotKit HTTP error (in utils/errors.ts): given a fetch status, it chooses the right error class — 400 becomes CopilotKitApiDiscoveryError, 404 on a remote endpoint becomes CopilotKitRemoteEndpointDiscoveryError — propagating the caller-supplied message. The throw you see is the 400/404 discovery failure path, meaning the runtime URL/agent endpoint probing failed.","triggerScenarios":"Probing a CopilotKit runtime that returns 400 (malformed discovery request / wrong URL path) or 404 (no runtime at that URL), during client initialization or agent discovery.","commonSituations":"Wrong runtimeUrl (pointing at the frontend origin or a nonexistent route), runtime not deployed, reverse proxy stripping paths, agent route not registered on the runtime.","solutions":["Verify the runtimeUrl points at the CopilotKit runtime endpoint and that it responds (curl the /info or agents route)","Fix proxy/rewrite rules so discovery paths reach the runtime","If 404 from a remote endpoint, confirm the remote agent is registered and the URL includes any required base path"],"exampleFix":"// before\nconst runtimeUrl = \"https://myapp.com\"; // frontend, not runtime\n// after\nconst runtimeUrl = \"https://myapp.com/api/copilotkit\";","handlingStrategy":"try-catch","validationCode":"const res = await fetch(`${runtimeUrl}/info`);\nif (!res.ok) console.warn(`Runtime probe failed: ${res.status}`);","typeGuard":null,"tryCatchPattern":"try { /* init/discovery */ } catch (e) {\n  if (e instanceof CopilotKitApiDiscoveryError || e instanceof CopilotKitRemoteEndpointDiscoveryError) {\n    // check runtimeUrl, proxy config\n  }\n  throw e;\n}","preventionTips":["Smoke-test the runtime /info route at deploy time","Keep runtimeUrl pointing at the runtime's mounted base path"],"tags":["shared","errors","http","discovery","runtime-url"],"backgroundTag":"endpoint-not-found","analyzedSha":"68fbe97d87420bd84e8196965c71bd6e394a3f7a","analyzedAt":"2026-08-27T04:03:26.537Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}