{"record":{"id":"4b14da26596db555","repo":"BigPizzaV3/CodexPlusPlus","slug":"codex-http-4b14da","errorCode":null,"errorMessage":"当前 Codex 的 HTTP 服务尚未就绪，请稍后重试","messagePattern":"当前 Codex 的 HTTP 服务尚未就绪，请稍后重试","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"tools/conversation-canvas/src/native-api.js","lineNumber":9,"sourceCode":"// HTTP uses the app host, with versioned runtime bindings, not renderer fetch/CSP.\nasync function nativeApiRequest(url,options){\n  const localError=message=>Object.assign(Error(message),{canvasApiLocal:true});\n  let native;\n  try{native=await loadNativeRuntime();}catch{throw localError('当前 Codex 版本的 API 适配器不兼容，请更新对话脉络脚本');}\n  if(typeof native.lGt!=='function')throw localError('当前 Codex 版本未提供兼容的 HTTP 服务');\n  native.lGt();\n  const client=native.cGt?.getInstance?.();\n  if(typeof client?.fetch!=='function'||!native.jR?.httpFetch)throw localError('当前 Codex 的 HTTP 服务尚未就绪，请稍后重试');\n  const {onProgress,...fetchOptions}=options;\n  const response=await client.fetch(url,fetchOptions);\n  return readApiResponse(response,options.signal,onProgress);\n}\n","sourceCodeStart":1,"sourceCodeEnd":14,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/tools/conversation-canvas/src/native-api.js#L1-L14","documentation":"nativeApiRequest checks that the native HTTP client is fully ready: client.fetch must be a function and the jR.httpFetch binding present. If either is missing, the HTTP service exists but is not ready, and this retry-later error is thrown.","triggerScenarios":"nativeApiRequest invoked during app startup before the native HTTP client singleton is initialized (cGt.getInstance() returns an object without fetch, or jR.httpFetch is undefined).","commonSituations":"Canvas script runs immediately after Codex app launch before the HTTP service initializes; app still bootstrapping after a reload; partially-failed Codex update left the HTTP service uninitialized.","solutions":["Wait a few seconds and click refresh — the HTTP service usually finishes initializing","Reload the Codex window to restart service initialization","If it persists, reinstall/repair the Codex app","Check the script for a readiness-retry before calling nativeApiRequest"],"exampleFix":"// before\nif(typeof client?.fetch!=='function'||!native.jR?.httpFetch)throw localError('当前 Codex 的 HTTP 服务尚未就绪，请稍后重试');\n// after\nfor(let i=0;i<5&&(typeof client?.fetch!=='function'||!native.jR?.httpFetch);i++)await new Promise(r=>setTimeout(r,1000));\nif(typeof client?.fetch!=='function'||!native.jR?.httpFetch)throw localError('当前 Codex 的 HTTP 服务尚未就绪，请稍后重试');","handlingStrategy":"retry","validationCode":"const ready=await poll(()=>{const c=native.cGt?.getInstance?.();return typeof c?.fetch==='function'&&!!native.jR?.httpFetch;},{timeout:10000});","typeGuard":"const httpReady=(n)=>typeof n?.cGt?.getInstance?.()?.fetch==='function'&&!!n?.jR?.httpFetch;","tryCatchPattern":"try{await nativeApiRequest(url,opts);}catch(e){if(/尚未就绪/.test(e.message)){await sleep(3000);return retry();}throw e;}","preventionTips":["Delay the first native API call until app bootstrap completes","Use exponential backoff for readiness retries","Avoid issuing native calls in the first seconds after a window reload"],"tags":["http-service","initialization","retry"],"backgroundTag":"request-timeout","analyzedSha":"b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6","analyzedAt":"2026-09-19T23:35:21.129Z","contentChangedAt":"2026-09-19T23:35:21.129Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}