{"record":{"id":"ec752a8a2d0525bf","repo":"abhigyanpatwari/GitNexus","slug":"failed-to-start-embedding-generation","errorCode":null,"errorMessage":"Failed to start embedding generation","messagePattern":"Failed to start embedding generation","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"gitnexus/src/server/api.ts","lineNumber":1947,"sourceCode":"            const current = embedJobManager.getJob(job.id);\n            if (!current || current.status !== 'failed') {\n              embedJobManager.updateJob(job.id, {\n                status: 'failed',\n                error: err.message || 'Embedding generation failed',\n              });\n            }\n          } finally {\n            clearTimeout(embedTimeout);\n            releaseRepoLock(repoLockPath);\n          }\n        })();\n\n        res.status(202).json({ jobId: job.id, status: 'analyzing' });\n      } catch (err: any) {\n        if (err.message?.includes('already in progress')) {\n          res.status(409).json({ error: err.message });\n        } else {\n          res.status(500).json({ error: err.message || 'Failed to start embedding generation' });\n        }\n      }\n    },\n  );\n\n  // GET /api/embed/:jobId — poll embedding job status\n  app.get('/api/embed/:jobId', (req, res) => {\n    const job = embedJobManager.getJob(req.params.jobId);\n    if (!job) {\n      res.status(404).json({ error: 'Job not found' });\n      return;\n    }\n    res.json({\n      id: job.id,\n      status: job.status,\n      repoName: job.repoName,\n      progress: job.progress,\n      error: job.error,","sourceCodeStart":1929,"sourceCodeEnd":1965,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/aac7515d2a8c50a1f8f923c6fb77218b333560d6/gitnexus/src/server/api.ts#L1929-L1965","documentation":"HTTP 500 returned by POST /api/embed's outer catch when route setup throws anything other than an 'already in progress' conflict (the repo-lock case is answered 409 earlier in the handler flow). err.message is forwarded when present; the literal 'Failed to start embedding generation' appears only for an anonymous error with an empty message. The underlying failure is visible in the serve logs.","triggerScenarios":"Unexpected throws during embed job creation or route setup — storage or environment problems that make an early step throw; GitNexus bugs; error objects lacking messages reaching the catch.","commonSituations":"Disk-full or read-only storage breaking job setup; version skew after upgrades; rare crashes reported with no forwarded message — the literal fallback text is the tell.","solutions":["Check the serve console for the real error — the 500 body is intentionally unhelpful","Verify the repo resolves (GET /api/repos) and is not locked by a running analyze (that case returns 409, not 500)","Retry once after any active job settles","If reproducible, update GitNexus and report — a 500 on this route is a server defect"],"exampleFix":"// before\nconst { jobId } = await res.json(); // throws on 500\n\n// after\nif (res.status === 409) { /* adopt/poll the active job */ }\nelse if (res.status >= 500) { await backoffRetry(() => postEmbed(repoName), 2); }\nelse if (!res.ok) throw new Error((await res.json()).error);","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"Mirror the analyze route pattern: 409 → adopt/poll the active job; 5xx → retry the idempotent embed POST with backoff; 4xx → surface the forwarded error text.","preventionTips":["Check the serve log for the real error","Confirm the repo resolves via /api/repos first","Retry 5xx once or twice after active jobs settle"],"tags":["http-500","internal-error","embeddings","job-scheduler"],"backgroundTag":"http-500-internal-server-error","analyzedSha":"aac7515d2a8c50a1f8f923c6fb77218b333560d6","analyzedAt":"2026-08-20T23:29:22.980Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}