fix: err handling for claude code session limit

This commit is contained in:
ajmallesh
2025-10-30 10:28:35 -07:00
parent 5b92ff52c4
commit cc36fe933d
2 changed files with 4 additions and 0 deletions

View File

@@ -273,6 +273,9 @@ async function runClaudePrompt(prompt, sourceDir, allowedTools = 'Read', context
// Check for API error patterns in assistant message content
if (content && typeof content === 'string') {
const lowerContent = content.toLowerCase();
if (lowerContent.includes('session limit reached')) {
throw new PentestError('Session limit reached', 'billing', false);
}
if (lowerContent.includes('api error') || lowerContent.includes('terminated')) {
apiErrorDetected = true;
console.log(chalk.red(` ⚠️ API Error detected in assistant response: ${content.trim()}`));

View File

@@ -134,6 +134,7 @@ export const isRetryableError = (error) => {
message.includes('invalid prompt') ||
message.includes('out of memory') ||
message.includes('permission denied') ||
message.includes('session limit reached') ||
message.includes('invalid api key')) {
return false;
}