{"record":{"id":"0cd2feac6234e548","repo":"jackwener/OpenCLI","slug":"midjourney-history","errorCode":null,"errorMessage":"midjourney history","messagePattern":"midjourney history","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"warning","filePath":"clis/midjourney/history.js","lineNumber":85,"sourceCode":"        rows.push({\n          job_id: normalized.jobId,\n          parent_job_id: normalized.parentJobId,\n          status: normalized.status,\n          type: video ? 'video' : 'image',\n          operation: normalized.operation,\n          model: normalized.model,\n          resolution: normalized.resolution,\n          created_at: normalized.createdAt,\n          batch_size: normalized.batchSize,\n          command,\n          url: normalized.url,\n        });\n        if (rows.length >= limit) break;\n      }\n      if (!result.cursor || result.cursor === cursor || !pageJobs.length) break;\n      cursor = result.cursor;\n    }\n    if (!rows.length) throw new EmptyResultError('midjourney history', 'No jobs matched the requested filters.');\n    return rows.slice(0, limit);\n  },\n});\n","sourceCodeStart":67,"sourceCodeEnd":89,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/midjourney/history.js#L67-L89","documentation":"EmptyResultError('midjourney history') is thrown by `opencli midjourney history` after successfully fetching up to 10 pages of job history from the Midjourney API, when zero jobs matched the requested --type/--status/--query filters. It indicates the command worked (auth and API calls succeeded) but the filter combination produced an empty result set.","triggerScenarios":"`opencli midjourney history --status failed` when no jobs have failed; `--type video` for an account that never generated video; `--query \"xyz\"` where the prompt substring matches nothing; filters that are valid but exclude all recent jobs within the 10-page fetch window.","commonSituations":"New accounts with little or no history; querying a status that is transient (e.g. 'running' when nothing is currently rendering); searching an old prompt that has aged past the paginated window; mixing filters (type=video AND status=completed) that no row satisfies.","solutions":["Loosen filters: run `opencli midjourney history` with no --type/--status/--query to see everything recent.","Drop --query or use a shorter distinctive substring of the prompt.","Wrap the call in a try/catch for EmptyResultError if 'no matches' is an acceptable outcome in your script.","Verify the account (via `opencli midjourney whoami`) is the one that actually generated the jobs."],"exampleFix":"// before\nopencli midjourney history --type video --query \"teapot\"\n// after (loosen until rows appear)\nopencli midjourney history --type video\n# or catch it:\ntry { ... } catch (e) { if (e.name === 'EmptyResultError') return []; throw e; }","handlingStrategy":"try-catch","validationCode":"// Preflight: check the account has any history at all with unfiltered query\nconst anyRows = await opencli.midjourney.history({ limit: 1 }); // throws EmptyResultError only if account has zero jobs","typeGuard":"function isEmptyResultError(e) { return e instanceof EmptyResultError || (e && e.name === 'EmptyResultError' && /midjourney history/.test(e.message ?? '')); }","tryCatchPattern":"import { EmptyResultError } from '@jackwener/opencli/errors';\ntry {\n  rows = await opencli.midjourney.history({ type: 'video', status: 'completed' });\n} catch (e) {\n  if (isEmptyResultError(e)) { rows = []; } // empty is a normal outcome\n  else throw e;\n}","preventionTips":["Treat empty results as a normal state in scripts and catch EmptyResultError explicitly.","Loosen --query to a short, distinctive substring; long exact prompts rarely match.","Verify each filter actually has candidate rows: run unfiltered history first when debugging.","Remember results are limited to a 10-page fetch window — very old jobs won't appear even with valid filters."],"tags":["empty-result","cli","filtering","midjourney"],"backgroundTag":"empty-result-set","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}