jackwener/OpenCLI · error · ArgumentError

uid must be a non-empty session UID

Error message

uid must be a non-empty session UID

What it means

The `manus read` command requires a positional `uid` argument identifying the Manus session to fetch. Before making any API call, the code normalizes the argument with `String(kwargs?.uid || '').trim()` and throws this ArgumentError if the result is empty. This is a client-side input validation failure: no network request or browser navigation was attempted.

Source

Thrown at clis/manus/read.js:33

}

cli({
    site: 'manus',
    name: 'read',
    access: 'read',
    description: 'Show details for a specific Manus session.',
    domain: MANUS_DOMAIN,
    strategy: Strategy.COOKIE,
    browser: true,
    siteSession: 'persistent',
    navigateBefore: true,
    args: [
        { name: 'uid', positional: true, required: true, help: 'Session UID' },
    ],
    columns: ['Field', 'Value'],
    func: async (page, kwargs) => {
        const uid = String(kwargs?.uid || '').trim();
        if (!uid) throw new ArgumentError('uid', 'must be a non-empty session UID');

        await ensureOnManus(page);

        const data = requireObject(await page.evaluate(`(async () => {
            ${MANUS_API_CALL_JS}
            return callManusAPI('session.v1.SessionService/ListSessions', {
                page: 1,
                pageSize: 100,
            });
        })()`), 'read session');

        const sessions = requireArray(data.sessions, 'read session');
        const session = sessions.find((s) => s.uid === uid);

        if (!session) {
            throw new EmptyResultError('manus read', `Session not found: ${uid}`);
        }

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Pass a non-empty session UID: `manus read <uid>` (get one from `manus list` output).
  2. Check that the variable feeding the uid is set and non-blank, e.g. `[ -n "$UID_VALUE" ] && manus read "$UID_VALUE"`.
  3. If the uid comes from a JSON pipeline, verify the field name and that it is not null before invoking the command.

Example fix

// before (empty/whitespace value)
$ manus read "   "
// ArgumentError: uid: must be a non-empty session UID

// after
$ manus read sess_01J8ZK3M9A
// prints UID / Title / Status / ... rows
Defensive patterns

Strategy: validation

Validate before calling

function requireSessionUid(uid) {
  const v = String(uid ?? '').trim();
  if (!v) throw new Error('manus read requires a non-empty session UID');
  return v;
}
// run('manus read', requireSessionUid(cfg.sessionUid));

Type guard

const hasSessionUid = (v) => typeof v === 'string' && v.trim().length > 0;

Try / catch

try {
  await run('manus read', uid);
} catch (e) {
  if (e.name === 'ArgumentError') {
    console.error('Provide a session UID, e.g. `manus read <uid>` from `manus list`.');
    process.exitCode = 2;
  } else throw e;
}

Prevention

When it happens

Trigger: Running `opencli manus read` with no uid argument, with an empty string (`manus read ""`), or with a value consisting only of whitespace (`manus read " "`), since trim() empties those to '' before the `if (!uid)` check.

Common situations: Scripting the CLI where the uid comes from an unset variable or an upstream JSON field that is missing/null; pasting a uid that is actually whitespace or a placeholder; confusing the session's numeric ID with its UID string.

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


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/07963eef131fbd0b. Report an issue: GitHub.