[GH-ISSUE #149] 在长上下文(5k token左右)情况下,使用Cherry对接claude-kiro-oauth进行对话大概率出现{"message":"Improperly formed request.","reason":null} #120

Closed
opened 2026-02-27 07:18:05 +03:00 by kerem · 2 comments
Owner

Originally created by @Yoahoug on GitHub (Jan 2, 2026).
Original GitHub issue: https://github.com/justlovemaki/AIClient-2-API/issues/149

请求格式有问题,以下是有价值的日志,多余部分已经去除。

[19:46:33] [INFO] 1/2/2026, 11:46:33 AM
[19:46:33] [INFO] [Server] Received request: POST http://[YOUR_DOMAIN].zeabur.app/claude-kiro-oauth/v1/chat/completions
[19:46:33] [INFO] [Config] MODEL_PROVIDER overridden by path segment to: claude-kiro-oauth
[19:46:33] [INFO] [API Service] Using pooled configuration for claude-kiro-oauth
[19:46:33] [INFO] [Adapter] getServiceAdapter, provider: claude-kiro-oauth
[19:46:35] [INFO] [Content Generation] Model: claude-sonnet-4-5, Stream: true
[19:46:35] [INFO] [Request Convert] Converting request from openai to claude-kiro-oauth
[19:46:35] [INFO] [Kiro] Calling generateContentStream with model: claude-sonnet-4-5 (real streaming)
[19:46:36] [ERROR] [Kiro] Stream API call failed: Request failed with status code 400
[19:46:36] [ERROR] [Kiro] Error in streaming generation: {
"message": "Request failed with status code 400",
"name": "AxiosError",
"config": {
"url": "https://codewhisperer.us-east-1.amazonaws.com/generateAssistantResponse",
"method": "POST",
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
"x-amzn-kiro-agent-mode": "vibe",
"Authorization": "Bearer [REDACTED_TOKEN]",
"amz-sdk-invocation-id": "[REDACTED_UUID]"
},
"data": "{"conversationState":{"chatTriggerType":"MANUAL","conversationId":"[REDACTED]","currentMessage":{"userInputMessage":{"content":"**"}}}}"
},
"response": {
"status": 400,
"statusMessage": "Bad Request",
"headers": {
"x-amzn-ErrorType": "ValidationException"
},
"data": "{"message":"Improperly formed request.","reason":null}"
}
}
[21:54:37] [ERROR] [Server] Error during stream processing: Error: Error processing response: Request failed with status code 400

Originally created by @Yoahoug on GitHub (Jan 2, 2026). Original GitHub issue: https://github.com/justlovemaki/AIClient-2-API/issues/149 请求格式有问题,以下是有价值的日志,多余部分已经去除。 [19:46:33] [INFO] 1/2/2026, 11:46:33 AM [19:46:33] [INFO] [Server] Received request: POST http://[YOUR_DOMAIN].zeabur.app/claude-kiro-oauth/v1/chat/completions [19:46:33] [INFO] [Config] MODEL_PROVIDER overridden by path segment to: claude-kiro-oauth [19:46:33] [INFO] [API Service] Using pooled configuration for claude-kiro-oauth [19:46:33] [INFO] [Adapter] getServiceAdapter, provider: claude-kiro-oauth [19:46:35] [INFO] [Content Generation] Model: claude-sonnet-4-5, Stream: true [19:46:35] [INFO] [Request Convert] Converting request from openai to claude-kiro-oauth [19:46:35] [INFO] [Kiro] Calling generateContentStream with model: claude-sonnet-4-5 (real streaming) [19:46:36] [ERROR] [Kiro] Stream API call failed: Request failed with status code 400 [19:46:36] [ERROR] [Kiro] Error in streaming generation: { "message": "Request failed with status code 400", "name": "AxiosError", "config": { "url": "https://codewhisperer.us-east-1.amazonaws.com/generateAssistantResponse", "method": "POST", "headers": { "Accept": "application/json", "Content-Type": "application/json", "x-amzn-kiro-agent-mode": "vibe", "Authorization": "Bearer [REDACTED_TOKEN]", "amz-sdk-invocation-id": "[REDACTED_UUID]" }, "data": "{\"conversationState\":{\"chatTriggerType\":\"MANUAL\",\"conversationId\":\"[REDACTED]\",\"currentMessage\":{\"userInputMessage\":{\"content\":\"**\"}}}}" }, "response": { "status": 400, "statusMessage": "Bad Request", "headers": { "x-amzn-ErrorType": "ValidationException" }, "data": "{\"message\":\"Improperly formed request.\",\"reason\":null}" } } [21:54:37] [ERROR] [Server] Error during stream processing: Error: Error processing response: Request failed with status code 400
kerem closed this issue 2026-02-27 07:18:05 +03:00
Author
Owner

@Yoahoug commented on GitHub (Jan 2, 2026):

[Request Convert] Converting request from openai to claude-kiro-oauth
kiroApiService not initialized, attempting to re-initialize...
[Kiro] Initializing Kiro API Service...
[Kiro Auth] Attempting to load credentials from directory: ./configs/kiro/[REDACTED]_kiro-auth-token
[Kiro Auth] Successfully loaded OAuth credentials from ./configs/kiro/[REDACTED]_kiro-auth-token/[REDACTED]_kiro-auth-token.json
[Kiro] Expiry date: 1767368541474, Current time: 1767366903295, 15 minutes from now: 1767367803295
[Kiro] Calling generateContentStream with model: claude-sonnet-4-5 (real streaming)
[Kiro] Stream API call failed: Request failed with status code 400
[Kiro] Error in streaming generation: AxiosError: Request failed with status code 400
at settle (file:///app/node_modules/axios/lib/core/settle.js:19:12)
at RedirectableRequest.handleResponse (file:///app/node_modules/axios/lib/adapters/http.js:547:9)
at RedirectableRequest.emit (node:events:536:35)
at RedirectableRequest._processResponse (/app/node_modules/follow-redirects/index.js:409:10)
at RedirectableRequest._onNativeResponse (/app/node_modules/follow-redirects/index.js:102:12)
at Object.onceWrapper (node:events:639:26)
at ClientRequest.emit (node:events:524:28)
at HTTPParser.parserOnIncomingClient (node:_http_client:702:27)
at HTTPParser.parserOnHeadersComplete (node:_http_common:118:17)
at TLSSocket.socketOnData (node:_http_client:544:22)
at Axios.request (file:///app/node_modules/axios/lib/core/Axios.js:45:41)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async KiroApiService.streamApiReal (file:///app/src/claude/claude-kiro.js:1403:30)
at async KiroApiService.generateContentStream (file:///app/src/claude/claude-kiro.js:1522:30)
at async KiroApiServiceAdapter.generateContentStream (file:///app/src/adapter.js:278:9)
at async handleStreamRequest (file:///app/src/common.js:197:26)
at async handleContentGenerationRequest (file:///app/src/common.js:440:9)
at async handleAPIRequests (file:///app/src/api-manager.js:39:13)
at async Server.requestHandler (file:///app/src/request-handler.js:203:32) {
code: 'ERR_BAD_REQUEST',
config: {
timeout: 300000,
headers: Object [AxiosHeaders] {
Accept: 'application/json',
'Content-Type': 'application/json',
'amz-sdk-request': 'attempt=1; max=1',
'x-amzn-kiro-agent-mode': 'vibe',
'Authorization': 'Bearer [REDACTED]',
'amz-sdk-invocation-id': '[REDACTED]',
'Content-Length': '323377'
},
method: 'post',
url: 'https://codewhisperer.us-east-1.amazonaws.com/generateAssistantResponse',
data: '{"conversationState":{"chatTriggerType":"MANUAL","conversationId":"030b111f-d17d-4586-841a-17cbb4307d42","currentMessage":{"userInputMessage":{"content":"Continue","modelId":"CLAUDE_SONNET_4_5_20250929_V1_0","origin":"AI_EDITOR","images":[{"format":"png","source":{"bytes":"[IMAGE_DATA_REDACTED]"}}]'
},
response: {
status: 400,
statusText: 'Bad Request',
headers: Object [AxiosHeaders] {
'x-amzn-requestid': '[REDACTED]',
'x-amzn-errortype': 'ValidationException:http://internal.amazon.com/coral/com.amazon.aws.codewhisperer/',
'cache-control': 'no-cache'
}
}
}
[Provider Pool] Marking claude-kiro-oauth as unhealthy due to stream error
[Server] Error during stream processing: Error: Error processing response: Request failed with status code 400
[ProviderPoolManager] Provider [REDACTED] for type claude-kiro-oauth error count: 1/3. Still healthy.
[Server] Received request: GET http://localhost:3000/health

<!-- gh-comment-id:3705570071 --> @Yoahoug commented on GitHub (Jan 2, 2026): [Request Convert] Converting request from openai to claude-kiro-oauth kiroApiService not initialized, attempting to re-initialize... [Kiro] Initializing Kiro API Service... [Kiro Auth] Attempting to load credentials from directory: ./configs/kiro/[REDACTED]_kiro-auth-token [Kiro Auth] Successfully loaded OAuth credentials from ./configs/kiro/[REDACTED]_kiro-auth-token/[REDACTED]_kiro-auth-token.json [Kiro] Expiry date: 1767368541474, Current time: 1767366903295, 15 minutes from now: 1767367803295 [Kiro] Calling generateContentStream with model: claude-sonnet-4-5 (real streaming) [Kiro] Stream API call failed: Request failed with status code 400 [Kiro] Error in streaming generation: AxiosError: Request failed with status code 400 at settle (file:///app/node_modules/axios/lib/core/settle.js:19:12) at RedirectableRequest.handleResponse (file:///app/node_modules/axios/lib/adapters/http.js:547:9) at RedirectableRequest.emit (node:events:536:35) at RedirectableRequest._processResponse (/app/node_modules/follow-redirects/index.js:409:10) at RedirectableRequest._onNativeResponse (/app/node_modules/follow-redirects/index.js:102:12) at Object.onceWrapper (node:events:639:26) at ClientRequest.emit (node:events:524:28) at HTTPParser.parserOnIncomingClient (node:_http_client:702:27) at HTTPParser.parserOnHeadersComplete (node:_http_common:118:17) at TLSSocket.socketOnData (node:_http_client:544:22) at Axios.request (file:///app/node_modules/axios/lib/core/Axios.js:45:41) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async KiroApiService.streamApiReal (file:///app/src/claude/claude-kiro.js:1403:30) at async KiroApiService.generateContentStream (file:///app/src/claude/claude-kiro.js:1522:30) at async KiroApiServiceAdapter.generateContentStream (file:///app/src/adapter.js:278:9) at async handleStreamRequest (file:///app/src/common.js:197:26) at async handleContentGenerationRequest (file:///app/src/common.js:440:9) at async handleAPIRequests (file:///app/src/api-manager.js:39:13) at async Server.requestHandler (file:///app/src/request-handler.js:203:32) { code: 'ERR_BAD_REQUEST', config: { timeout: 300000, headers: Object [AxiosHeaders] { Accept: 'application/json', 'Content-Type': 'application/json', 'amz-sdk-request': 'attempt=1; max=1', 'x-amzn-kiro-agent-mode': 'vibe', 'Authorization': 'Bearer [REDACTED]', 'amz-sdk-invocation-id': '[REDACTED]', 'Content-Length': '323377' }, method: 'post', url: 'https://codewhisperer.us-east-1.amazonaws.com/generateAssistantResponse', data: '{"conversationState":{"chatTriggerType":"MANUAL","conversationId":"030b111f-d17d-4586-841a-17cbb4307d42","currentMessage":{"userInputMessage":{"content":"Continue","modelId":"CLAUDE_SONNET_4_5_20250929_V1_0","origin":"AI_EDITOR","images":[{"format":"png","source":{"bytes":"[IMAGE_DATA_REDACTED]"}}]' }, response: { status: 400, statusText: 'Bad Request', headers: Object [AxiosHeaders] { 'x-amzn-requestid': '[REDACTED]', 'x-amzn-errortype': 'ValidationException:http://internal.amazon.com/coral/com.amazon.aws.codewhisperer/', 'cache-control': 'no-cache' } } } [Provider Pool] Marking claude-kiro-oauth as unhealthy due to stream error [Server] Error during stream processing: Error: Error processing response: Request failed with status code 400 [ProviderPoolManager] Provider [REDACTED] for type claude-kiro-oauth error count: 1/3. Still healthy. [Server] Received request: GET http://localhost:3000/health
Author
Owner

@justlovemaki commented on GitHub (Jan 4, 2026):

#154

<!-- gh-comment-id:3707823961 --> @justlovemaki commented on GitHub (Jan 4, 2026): #154
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/AIClient-2-API-justlovemaki#120
No description provided.