jackwener/OpenCLI · warning · EmptyResultError
midjourney history
Error message
midjourney history
What it means
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.
Source
Thrown at clis/midjourney/history.js:85
rows.push({
job_id: normalized.jobId,
parent_job_id: normalized.parentJobId,
status: normalized.status,
type: video ? 'video' : 'image',
operation: normalized.operation,
model: normalized.model,
resolution: normalized.resolution,
created_at: normalized.createdAt,
batch_size: normalized.batchSize,
command,
url: normalized.url,
});
if (rows.length >= limit) break;
}
if (!result.cursor || result.cursor === cursor || !pageJobs.length) break;
cursor = result.cursor;
}
if (!rows.length) throw new EmptyResultError('midjourney history', 'No jobs matched the requested filters.');
return rows.slice(0, limit);
},
});
View on GitHub (pinned to 49907e53dc)
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.
Example fix
// before
opencli midjourney history --type video --query "teapot"
// after (loosen until rows appear)
opencli midjourney history --type video
# or catch it:
try { ... } catch (e) { if (e.name === 'EmptyResultError') return []; throw e; } Defensive patterns
Strategy: try-catch
Validate before calling
// Preflight: check the account has any history at all with unfiltered query
const anyRows = await opencli.midjourney.history({ limit: 1 }); // throws EmptyResultError only if account has zero jobs Type guard
function isEmptyResultError(e) { return e instanceof EmptyResultError || (e && e.name === 'EmptyResultError' && /midjourney history/.test(e.message ?? '')); } Try / catch
import { EmptyResultError } from '@jackwener/opencli/errors';
try {
rows = await opencli.midjourney.history({ type: 'video', status: 'completed' });
} catch (e) {
if (isEmptyResultError(e)) { rows = []; } // empty is a normal outcome
else throw e;
} Prevention
- 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.
When it happens
Trigger: `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.
Common situations: 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.
Understand the failure class
Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.
Related errors
- No holdings matched account filter: ${filter}
- No prices returned for train_no=${trainNo} ${fromStation.nam
- No 12306 stations match "${keyword}"
- CoinGecko returned no category data.
- coingecko top
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/0cd2feac6234e548.
Report an issue: GitHub.