{"record":{"id":"6cca697f3a7d3e6d","repo":"paperclipai/paperclip","slug":"could-not-determine-remote-file-size-for-remotep","errorCode":null,"errorMessage":"Could not determine remote file size for ${remotePath}","messagePattern":"Could not determine remote file size for (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/adapter-utils/src/command-managed-runtime.ts","lineNumber":363,"sourceCode":"        // Shell-backed sandbox reads need the same absent-file contract as fs.\n        // Confirm the parent is searchable so permission/transport failures are\n        // never silently converted into a missing optional credential file.\n        const parent = shellQuote(path.posix.dirname(remotePath));\n        const missing = await runShell(\n          `if [ -d ${parent} ] && [ -x ${parent} ] && [ ! -e ${shellQuote(remotePath)} ]; ` +\n            `then printf 'missing'; fi`,\n        ).catch(() => null);\n        if (missing?.stdout === \"missing\") {\n          throw Object.assign(new Error(`No such file: ${remotePath}`), {\n            code: \"ENOENT\",\n            path: remotePath,\n          });\n        }\n        throw error;\n      }\n      const totalBytes = Number.parseInt(sizeResult.stdout.trim(), 10);\n      if (!Number.isFinite(totalBytes) || totalBytes < 0) {\n        throw new Error(`Could not determine remote file size for ${remotePath}`);\n      }\n\n      // Read in bounded remote chunks so the runner never has to materialize a\n      // single base64 stdout string for the whole archive. The client API still\n      // returns the decoded file as a Buffer, but every command result stays\n      // small enough for provider-backed sandbox RPCs.\n      const decodedChunks: Buffer[] = [];\n      let decodedSoFar = 0;\n      if (totalBytes === 0) {\n        await options?.onProgress?.(0, 0);\n        return Buffer.alloc(0);\n      }\n      for (let chunkIndex = 0; decodedSoFar < totalBytes; chunkIndex++) {\n        const result = await runShell(\n          `dd if=${shellQuote(remotePath)} bs=${REMOTE_READ_CHUNK_BYTES} skip=${chunkIndex} count=1 2>/dev/null | base64`,\n        );\n        const chunk = Buffer.from(result.stdout.replace(/\\s+/g, \"\"), \"base64\");\n        if (chunk.byteLength === 0) break;","sourceCodeStart":345,"sourceCodeEnd":381,"githubUrl":"https://github.com/paperclipai/paperclip/blob/3f1d897a7c018d76563a21c6e39c3c9b03933622/packages/adapter-utils/src/command-managed-runtime.ts#L345-L381","documentation":"Pre-flight check in the command-managed client's writeFile path: the remote target's size could not be determined (stat/ls probe failed or returned nothing) before attempting a chunked or atomic remote write, so the write strategy cannot be chosen safely.","triggerScenarios":"Thrown at packages/adapter-utils/src/command-managed-runtime.ts:290 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the remote file ${remotePath} exists and is readable, then retry.","Check sandbox connectivity and permissions on the remote path."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3f1d897a7c018d76563a21c6e39c3c9b03933622","analyzedAt":"2026-09-18T08:03:59.046Z","contentChangedAt":"2026-09-18T08:03:59.046Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}