{"record":{"id":"2184cb550ac2f754","repo":"jackwener/OpenCLI","slug":"job-jobid-was-not-found-in-the-current-account","errorCode":null,"errorMessage":"Job ${jobId} was not found in the current account.","messagePattern":"Job (.+?) was not found in the current account\\.","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"error","filePath":"clis/midjourney/utils.js","lineNumber":352,"sourceCode":"\nexport async function fetchJobStatuses(page, jobIds) {\n  if (!Array.isArray(jobIds) || !jobIds.length) return [];\n  const payload = await midjourneyJson(page, '/api/job-status', {\n    method: 'POST',\n    headers: { 'Content-Type': 'application/json' },\n    body: { jobIds, _frontend_source: 'opencli_adapter' },\n  });\n  if (!Array.isArray(payload)) {\n    throw new CommandExecutionError('Midjourney job-status endpoint returned a malformed payload');\n  }\n  return payload;\n}\n\nexport async function fetchJobStatus(page, jobId, { allowMissing = false } = {}) {\n  const payload = await fetchJobStatuses(page, [jobId]);\n  const job = payload.find((row) => row?.id === jobId) || null;\n  if (!job && !allowMissing) {\n    throw new EmptyResultError('midjourney status', `Job ${jobId} was not found in the current account.`);\n  }\n  return job;\n}\n\nexport async function cancelMidjourneyJob(page, jobId) {\n  let result;\n  try {\n    result = unwrapEvaluateResult(await page.evaluate(async (id) => {\n      const response = await fetch('/api/job-cancel', {\n        method: 'POST',\n        headers: { 'Content-Type': 'application/json', 'X-CSRF-Protection': '1' },\n        body: JSON.stringify({ job_id: id }),\n      });\n      return { ok: response.ok, status: response.status, body: await response.text() };\n    }, jobId));\n  } catch (error) {\n    throw new CommandExecutionError(`Midjourney cancel request failed: ${errorMessage(error)}`);\n  }","sourceCodeStart":334,"sourceCodeEnd":370,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/midjourney/utils.js#L334-L370","documentation":"fetchJobStatus looks up a single job by ID within the array returned by fetchJobStatuses. If no row with a matching id exists and allowMissing is false, it throws EmptyResultError for the 'midjourney status' query. This signals the job ID is not present under the currently authenticated account rather than a network failure.","triggerScenarios":"Calling fetchJobStatus (or waitForCompletedJob, statuses source/job flows) with a jobId that does not exist for the logged-in Midjourney account, a typo'd or truncated job ID, or a job that has aged out / been deleted from the account history.","commonSituations":"Copying a job ID from a different Midjourney account or workspace; referencing a job whose history was purged (old jobs expire); casing mistakes since IDs are compared exactly against row?.id.","solutions":["Run the midjourney status/list command to confirm the job ID exists in the current account and copy it exactly.","Verify you are logged into the same Midjourney account that created the job.","Pass allowMissing: true if your flow tolerates absent jobs and handle the null return yourself.","Re-check the job URL on midjourney.com — if the web UI cannot find it, the job no longer exists."],"exampleFix":"// before\nconst job = await fetchJobStatus(page, jobId); // throws when absent\n// after\nconst job = await fetchJobStatus(page, jobId, { allowMissing: true });\nif (!job) console.warn(`Job ${jobId} not found; it may have expired or belong to another account.`);","handlingStrategy":"validation","validationCode":"// validate the job ID format before lookup\nif (!/^[0-9a-f-]{10,}$/i.test(jobId)) throw new Error(`Invalid Midjourney job ID: ${jobId}`);\n// optionally confirm existence with allowMissing first\nconst probe = await fetchJobStatus(page, jobId, { allowMissing: true });\nif (!probe) throw new Error(`Job ${jobId} not found in this account; check the ID or account.`);","typeGuard":"function isKnownJob(payload, jobId) {\n  return Array.isArray(payload) && payload.some((row) => row?.id === jobId);\n}","tryCatchPattern":"try {\n  const job = await fetchJobStatus(page, jobId);\n} catch (e) {\n  if (e.name === 'EmptyResultError' || String(e.message).includes('was not found')) {\n    console.error(`Job ${jobId} does not exist in the current account; list jobs to get valid IDs.`);\n  } else throw e;\n}","preventionTips":["Copy job IDs exactly from midjourney.com or CLI output, never retyped","Confirm you are in the same account/workspace that created the job","Use allowMissing: true when absence is an expected outcome","Remember old jobs expire from account history — persist job metadata you need long-term"],"tags":["midjourney","not-found","lookup"],"backgroundTag":"resource-not-found","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}