{"record":{"id":"cd3baf2c1c68286e","repo":"jackwener/OpenCLI","slug":"argument-cd3baf","errorCode":"ARGUMENT","errorMessage":"A review token is required.","messagePattern":"A review token is required\\.","errorType":"validation","errorClass":"CliError","httpStatus":null,"severity":"error","filePath":"clis/paperreview/review.js","lineNumber":20,"sourceCode":"import { CliError } from '@jackwener/opencli/errors';\nimport { PAPERREVIEW_DOMAIN, buildReviewUrl, ensureSuccess, requestJson, summarizeReview, } from './utils.js';\ncli({\n    site: 'paperreview',\n    name: 'review',\n    access: 'read',\n    description: 'Fetch a paperreview.ai review by token',\n    domain: PAPERREVIEW_DOMAIN,\n    strategy: Strategy.PUBLIC,\n    browser: false,\n    args: [\n        { name: 'token', positional: true, required: true, help: 'Review token returned by paperreview.ai' },\n        { name: 'timeout', type: 'int', required: false, default: 30, help: 'Max seconds for the overall command (default: 30)' },\n    ],\n    columns: ['status', 'title', 'venue', 'numerical_score', 'has_feedback', 'review_url'],\n    func: async (kwargs) => {\n        const token = String(kwargs.token ?? '').trim();\n        if (!token) {\n            throw new CliError('ARGUMENT', 'A review token is required.');\n        }\n        const { response, payload } = await requestJson(`/api/review/${encodeURIComponent(token)}`);\n        if (response.status === 202) {\n            return {\n                status: 'processing',\n                token,\n                review_url: buildReviewUrl(token),\n                title: '',\n                venue: '',\n                numerical_score: '',\n                has_feedback: '',\n                message: typeof payload === 'object' && payload ? payload.detail ?? 'Review is still processing.' : 'Review is still processing.',\n            };\n        }\n        ensureSuccess(response, payload, 'Failed to fetch the review.', 'Check the token and try again');\n        return summarizeReview(token, payload);\n    },\n});","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/paperreview/review.js#L2-L38","documentation":"The paperreview `review` command requires a review token to fetch the review result. It trims kwargs.token and throws CliError with code ARGUMENT when empty, before any HTTP request is made. This fails fast so the user corrects the invocation rather than hitting the API.","triggerScenarios":"Running the review command without --token, or passing an empty/whitespace-only token value.","commonSituations":"Automating the command with an environment variable that was never set; dropping the flag when re-running a long command line; token email not yet received.","solutions":["Re-run with --token <your-review-token>.","Echo/verify the token variable in scripts before invoking.","Wait for the review request to complete and use the token it issued."],"exampleFix":"// before\ncli review\n// after\ncli review --token abc123","handlingStrategy":"validation","validationCode":"const token = process.env.REVIEW_TOKEN;\nif (!token || !token.trim()) {\n  throw new Error('REVIEW_TOKEN is empty; run the submit step first');\n}","typeGuard":"function hasToken(v) {\n  return typeof v === 'string' && v.trim().length > 0;\n}","tryCatchPattern":"try {\n  await cli.review({ token: tokenArg });\n} catch (err) {\n  if (err.code === 'ARGUMENT') console.error('Pass --token <review-token>');\n  else throw err;\n}","preventionTips":["Persist the token issued at submission time and reuse it.","Assert non-empty token in CI wrappers.","Do not strip the --token flag when editing command lines."],"tags":["cli","validation","missing-argument"],"backgroundTag":"missing-required-argument","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}