{"record":{"id":"6dd1b22356c1b8fa","repo":"chatboxai/chatbox","slug":"json-stringify-json-6dd1b2","errorCode":null,"errorMessage":"JSON.stringify(json)","messagePattern":"JSON\\.stringify\\(json\\)","errorType":"http","errorClass":"ApiError","httpStatus":null,"severity":"error","filePath":"src/shared/providers/definitions/models/custom-claude.ts","lineNumber":107,"sourceCode":"\n  public async listModels(): Promise<ProviderModelInfo[]> {\n    type Response = {\n      data: { id: string; type: string }[]\n    }\n    const url = `${this.options.apiHost}/models?limit=990`\n    const res = await this.dependencies.request.apiRequest({\n      url: url,\n      method: 'GET',\n      useProxy: this.options.useProxy,\n      headers: {\n        'anthropic-version': '2023-06-01',\n        'anthropic-dangerous-direct-browser-access': 'true',\n        'x-api-key': this.options.apiKey,\n      },\n    })\n    const json: Response = await res.json()\n    if (!json['data']) {\n      throw new ApiError(JSON.stringify(json))\n    }\n    return json['data']\n      .filter((item) => item.type === 'model')\n      .map((item) => ({\n        modelId: item.id,\n        type: 'chat',\n      }))\n  }\n}\n","sourceCodeStart":89,"sourceCodeEnd":117,"githubUrl":"https://github.com/chatboxai/chatbox/blob/81571269addb6bafb589a920b2883f1e1e084fd1/src/shared/providers/definitions/models/custom-claude.ts#L89-L117","documentation":"Error \"JSON.stringify(json)\" thrown in chatboxai/chatbox.","triggerScenarios":"Thrown at src/shared/providers/definitions/models/custom-claude.ts:107 when the library encounters an invalid state.","commonSituations":"Occurs in src/shared/providers/definitions/models/custom-claude.ts when a custom Claude-compatible endpoint returns an error response whose JSON body is thrown as an ApiError.","solutions":["Verify the custom provider's API host URL is correct and reachable.","Check that the x-api-key configured for the custom Claude provider is valid.","Read the stringified response body to see the upstream error detail.","Ensure the endpoint implements the Anthropic /models API and returns a 'data' field."],"exampleFix":"const json: Response = await res.json()\nif (!json['data']) {\n  console.error('Custom Claude listModels error:', json)\n}","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"81571269addb6bafb589a920b2883f1e1e084fd1","analyzedAt":"2026-08-12T21:51:44.981Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}