jackwener/OpenCLI · error · ArgumentError
must be a conversation id, /app/<id> URL, or sidebar title
Error message
must be a conversation id, /app/<id> URL, or sidebar title
What it means
resolveTargetUrl in gemini detail throws ArgumentError with the message 'must be a conversation id, /app/<id> URL, or sidebar title' when the query argument is empty or only whitespace after trimming. It tells the caller which three forms of the --id argument are accepted. The error is raised before any page navigation or sidebar lookup happens.
Source
Thrown at clis/gemini/detail.js:24
ensureGeminiPage,
getGeminiConversationList,
getGeminiVisibleTurns,
resolveGeminiConversationForQuery,
} from './utils.js';
import { extractGeminiId } from './history.js';
/**
* Resolve the caller-supplied `<id>` argument into an absolute
* conversation URL. Accepts:
* 1. A bare conversation id (`b8368a89d4242e5f`)
* 2. A relative `/app/<id>` path
* 3. A full `https://gemini.google.com/app/<id>` URL
* 4. A sidebar title — looked up exactly first, then by substring
*/
async function resolveTargetUrl(page, query) {
const raw = String(query || '').trim();
if (!raw) {
throw new ArgumentError('id', 'must be a conversation id, /app/<id> URL, or sidebar title');
}
// Unambiguously id-shaped inputs (URL, /app/<id> path, or 16-hex bare id)
// skip the sidebar lookup. Generic alphanumeric strings always go through
// title-matching first so a chat called "Empire study" doesn't get treated
// as the literal conversation id "Empire study".
const directId = extractGeminiId(raw);
const looksLikeId =
raw.startsWith('http') ||
raw.startsWith('/app/') ||
/^[a-f0-9]{16,}$/i.test(raw);
if (directId && looksLikeId) {
return `${GEMINI_APP_URL}/${directId}`;
}
const conversations = await getGeminiConversationList(page);
const match = resolveGeminiConversationForQuery(conversations, raw, 'contains');
if (!match || !match.Url) {View on GitHub (pinned to 49907e53dc)
Solutions
- Provide a valid --id value: a bare conversation id, a full https://gemini.google.com/app/<id> URL, an /app/<id> path, or a sidebar title
- If the id comes from another command, capture the output of `opencli gemini history` first and use its Id or Url column
- Trim the value in scripts and skip the call if empty rather than invoking with a blank argument
- Check shell quoting so the argument actually reaches the command
Example fix
// before
const id = convo?.Id ?? '';
await run(['gemini', 'detail', '--id', id]);
// after
const id = convo?.Id ?? '';
if (!id.trim()) throw new Error('No conversation id available; run gemini history first');
await run(['gemini', 'detail', '--id', id]); Defensive patterns
Strategy: validation
Validate before calling
const id = (kwargs?.id ?? '').trim();
if (!id) throw new Error('gemini detail requires a non-empty --id (id, /app/<id> URL, or sidebar title)'); Type guard
function hasTarget(q){ return typeof q === 'string' && q.trim().length > 0; } Try / catch
try {
await run(['gemini','detail','--id', id]);
} catch (e) {
if (String(e.message).includes('must be a conversation id')) {
console.error('Provide --id as a conversation id, /app/<id> URL, or sidebar title.');
} else throw e;
} Prevention
- Resolve ids from `opencli gemini history` output before calling detail
- Trim and check non-empty before invoking
- Avoid passing possibly-empty variables; use shell defaults like ID="${ID:?missing id}"
When it happens
Trigger: Calling `opencli gemini detail` without --id; passing an empty string --id ''; passing whitespace ' '; passing null/undefined programmatically into the target command's kwargs.id.
Common situations: A script variable holding the conversation id is empty because a previous history lookup returned nothing; quoting mistakes dropping the value (--id ""); copy-paste that grabbed only whitespace; forgetting the flag on first use.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- symbol is required
- Either --product-id or --url is required
- --city is required (numeric city ID from `ctrip search` or `
- --${name} is required (e.g. 北京 / 上海)
- hotel id is required (numeric id from `ctrip hotel-suggest`,
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/7f6386b8bdeda3f9.
Report an issue: GitHub.