{"record":{"id":"07963eef131fbd0b","repo":"jackwener/OpenCLI","slug":"uid-must-be-a-non-empty-session-uid","errorCode":null,"errorMessage":"uid must be a non-empty session UID","messagePattern":"uid must be a non-empty session UID","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/manus/read.js","lineNumber":33,"sourceCode":"}\n\ncli({\n    site: 'manus',\n    name: 'read',\n    access: 'read',\n    description: 'Show details for a specific Manus session.',\n    domain: MANUS_DOMAIN,\n    strategy: Strategy.COOKIE,\n    browser: true,\n    siteSession: 'persistent',\n    navigateBefore: true,\n    args: [\n        { name: 'uid', positional: true, required: true, help: 'Session UID' },\n    ],\n    columns: ['Field', 'Value'],\n    func: async (page, kwargs) => {\n        const uid = String(kwargs?.uid || '').trim();\n        if (!uid) throw new ArgumentError('uid', 'must be a non-empty session UID');\n\n        await ensureOnManus(page);\n\n        const data = requireObject(await page.evaluate(`(async () => {\n            ${MANUS_API_CALL_JS}\n            return callManusAPI('session.v1.SessionService/ListSessions', {\n                page: 1,\n                pageSize: 100,\n            });\n        })()`), 'read session');\n\n        const sessions = requireArray(data.sessions, 'read session');\n        const session = sessions.find((s) => s.uid === uid);\n\n        if (!session) {\n            throw new EmptyResultError('manus read', `Session not found: ${uid}`);\n        }\n","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/manus/read.js#L15-L51","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Pass a non-empty session UID: `manus read <uid>` (get one from `manus list` output).","Check that the variable feeding the uid is set and non-blank, e.g. `[ -n \"$UID_VALUE\" ] && manus read \"$UID_VALUE\"`.","If the uid comes from a JSON pipeline, verify the field name and that it is not null before invoking the command."],"exampleFix":"// before (empty/whitespace value)\n$ manus read \"   \"\n// ArgumentError: uid: must be a non-empty session UID\n\n// after\n$ manus read sess_01J8ZK3M9A\n// prints UID / Title / Status / ... rows","handlingStrategy":"validation","validationCode":"function requireSessionUid(uid) {\n  const v = String(uid ?? '').trim();\n  if (!v) throw new Error('manus read requires a non-empty session UID');\n  return v;\n}\n// run('manus read', requireSessionUid(cfg.sessionUid));","typeGuard":"const hasSessionUid = (v) => typeof v === 'string' && v.trim().length > 0;","tryCatchPattern":"try {\n  await run('manus read', uid);\n} catch (e) {\n  if (e.name === 'ArgumentError') {\n    console.error('Provide a session UID, e.g. `manus read <uid>` from `manus list`.');\n    process.exitCode = 2;\n  } else throw e;\n}","preventionTips":["Resolve uids from `manus list` output rather than hardcoding them.","Validate that the variable holding the uid is non-blank before invoking the CLI.","When reading uids from JSON, coalesce and trim: String(obj?.uid ?? '').trim()."],"tags":["argument-validation","input-validation","cli"],"backgroundTag":"missing-required-argument","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}