{"record":{"id":"4c2d58a14bded9da","repo":"paperclipai/paperclip","slug":"input-label-sync-wrote-invalid-result-json-e","errorCode":null,"errorMessage":"${input.label} sync wrote invalid result JSON: ${error instanceof Error ? error.message : String(error)}","messagePattern":"(.+?) sync wrote invalid result JSON: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/adapter-utils/src/sandbox-callback-bridge.ts","lineNumber":1667,"sourceCode":" * `sha256sum` nor `shasum` — then the skip cannot be proven and we conservatively\n * re-upload (and the post-upload verify is best-effort, as noted inline).\n */\nexport async function syncRemoteTextFileWithHashSkip(input: {\n  runner: CommandManagedRuntimeRunner;\n  remoteCwd: string;\n  remoteDir: string;\n  remotePath: string;\n  body: string;\n  // Human-readable noun phrase used in fail-loud messages, e.g.\n  // \"Sandbox callback bridge entrypoint\" / \"Process session remote script\".\n  label: string;\n  // Short action label for `requireSuccessfulResult`, e.g.\n  // \"sync sandbox callback bridge entrypoint\".\n  action: string;\n  lockDir: string;\n  timeoutMs?: number | null;\n  shellCommand?: \"bash\" | \"sh\" | null;\n}): Promise<{ uploaded: boolean; sha256: string }> {\n  const timeoutMs = normalizeTimeoutMs(input.timeoutMs, DEFAULT_BRIDGE_RESPONSE_TIMEOUT_MS);\n  const shellCommand = preferredShellForSandbox(input.shellCommand);\n  const remotePartial = `${input.remotePath}.partial`;\n  const remoteUploadPath = `${input.remotePath}.paperclip-upload.b64`;\n  const base64Body = toBuffer(Buffer.from(input.body, \"utf8\")).toString(\"base64\");\n  const sha256 = createHash(\"sha256\").update(input.body, \"utf8\").digest(\"hex\");\n\n  const syncResult = await runShell(\n    input.runner,\n    input.remoteCwd,\n    [\n      \"set -eu\",\n      `remote_dir=${shellQuote(input.remoteDir)}`,\n      `remote_path=${shellQuote(input.remotePath)}`,\n      `remote_partial=${shellQuote(remotePartial)}`,\n      `remote_upload=${shellQuote(remoteUploadPath)}`,\n      `lock_dir=${shellQuote(input.lockDir)}`,\n      `expected_sha=${shellQuote(sha256)}`,","sourceCodeStart":1649,"sourceCodeEnd":1685,"githubUrl":"https://github.com/paperclipai/paperclip/blob/3f1d897a7c018d76563a21c6e39c3c9b03933622/packages/adapter-utils/src/sandbox-callback-bridge.ts#L1649-L1685","documentation":"Protocol-parsing failure after a sandbox sync upload: the shell pipeline (with optional sha verify) exited successfully but its trailing '{\"uploaded\":true}' marker failed to parse as JSON, so the upload result cannot be trusted from the command output alone.","triggerScenarios":"Thrown at packages/adapter-utils/src/sandbox-callback-bridge.ts:1527 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the JSON error and retry the ${input.label} sync.","Check for truncated writes in the sync result channel."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3f1d897a7c018d76563a21c6e39c3c9b03933622","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}