{"record":{"id":"dc379e7c9831dd0c","repo":"JuliusBrussee/caveman","slug":"retry-loop-interrupted-tool-call-json-stringify","errorCode":null,"errorMessage":"retry loop interrupted: tool call ${JSON.stringify(signature)} repeated ${repeats} times (threshold ${threshold})","messagePattern":"retry loop interrupted: tool call (.+?) repeated (.+?) times \\(threshold (.+?)\\)","errorType":"exception","errorClass":"RetryLoopError","httpStatus":null,"severity":"error","filePath":"packages/sdk/typescript/src/index.ts","lineNumber":694,"sourceCode":"      serialized = String(args);\n    }\n    return `${name}(${serialized})`;\n  }\n\n  /**\n   * Record a tool call. Throws {@link RetryLoopError} once an identical call has\n   * repeated past the threshold. A different call resets the streak.\n   */\n  record(name: string, args: unknown): void {\n    const sig = this.signature(name, args);\n    if (sig === this.lastSignature) {\n      this.repeats += 1;\n    } else {\n      this.lastSignature = sig;\n      this.repeats = 1;\n    }\n    if (this.repeats > this.threshold) {\n      throw new RetryLoopError(sig, this.repeats, this.threshold);\n    }\n  }\n\n  /** Record the call (may throw) then invoke `fn`. */\n  async guard<T>(name: string, args: unknown, fn: () => Promise<T> | T): Promise<T> {\n    this.record(name, args);\n    return fn();\n  }\n\n  /** Clear the streak (e.g. when starting a new task). */\n  reset(): void {\n    this.lastSignature = null;\n    this.repeats = 0;\n  }\n}\n\n// ─── Async job client ─────────────────────────────────────────────────────────\n","sourceCodeStart":676,"sourceCodeEnd":712,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/packages/sdk/typescript/src/index.ts#L676-L712","documentation":"Error \"retry loop interrupted: tool call ${JSON.stringify(signature)} repeated ${repeats} times (threshold ${threshold})\" thrown in JuliusBrussee/caveman.","triggerScenarios":"Thrown at packages/sdk/typescript/src/index.ts:694 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["The same tool call repeated past the threshold; change the prompt/tool flow to break the loop, or raise the repetition threshold."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}