{"record":{"id":"f80ee22905d4780d","repo":"jackwener/OpenCLI","slug":"steam-app-id-is-required-e-g-620-for-portal-2","errorCode":null,"errorMessage":"steam app id is required (e.g. \"620\" for Portal 2)","messagePattern":"steam app id is required \\(e\\.g\\. \"620\" for Portal 2\\)","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/steam/utils.js","lineNumber":43,"sourceCode":"    return code;\n}\n\nexport function requireBoundedInt(value, defaultValue, maxValue, label = 'limit') {\n    const raw = value ?? defaultValue;\n    const n = typeof raw === 'number' ? raw : Number(raw);\n    if (!Number.isInteger(n) || n <= 0) {\n        throw new ArgumentError(`steam ${label} must be a positive integer`);\n    }\n    if (n > maxValue) {\n        throw new ArgumentError(`steam ${label} must be <= ${maxValue}`);\n    }\n    return n;\n}\n\nexport function requireAppId(value) {\n    const s = String(value ?? '').trim();\n    if (!s) {\n        throw new ArgumentError('steam app id is required (e.g. \"620\" for Portal 2)');\n    }\n    if (!/^\\d+$/.test(s)) {\n        throw new ArgumentError(\n            `steam app id \"${value}\" must be a positive integer`,\n            'Copy the numeric id from `steam search` or the URL `store.steampowered.com/app/<id>/`.',\n        );\n    }\n    return s;\n}\n\nexport async function steamFetch(url, label) {\n    let resp;\n    try {\n        resp = await fetch(url, { headers: { 'user-agent': UA, accept: 'application/json' } });\n    }\n    catch (err) {\n        throw new CommandExecutionError(\n            `${label} request failed: ${err?.message ?? err}`,","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/steam/utils.js#L25-L61","documentation":"requireAppId requires a non-empty, all-digit app id; a missing value throws ArgumentError with an example ('620' for Portal 2). A present-but-non-numeric value throws a separate, more detailed error.","triggerScenarios":"Calling `steam app` without an id argument, or with an empty/whitespace value; ids pasted with surrounding text (e.g. 'app/620') go to the second check, not this one.","commonSituations":"Forgetting the positional id on the command line; shell variables that are unset; programmatic callers passing null/undefined.","solutions":["Provide the numeric app id, e.g. `steam app 620`","Run `steam search <name>` first to find the id","Extract the id from the store URL store.steampowered.com/app/<id>/","Catch ArgumentError and print usage including the Portal 2 example"],"exampleFix":"// before\nsteam app            // missing id\n// after\nsteam app 620","handlingStrategy":"validation","validationCode":"function requireAppIdArg(v) {\n  const s = String(v ?? '').trim();\n  if (!s) throw new Error('app id required; find it via `steam search` or store.steampowered.com/app/<id>/');\n  if (!/^\\d+$/.test(s)) throw new Error(`app id must be numeric, got: ${v}`);\n  return s;\n}","typeGuard":"function isNumericId(v) {\n  return typeof v === 'string' && /^\\d+$/.test(v.trim());\n}","tryCatchPattern":"try {\n  await cmd({ id: appId });\n} catch (e) {\n  if (e instanceof ArgumentError && /app id is required/.test(e.message)) {\n    console.error('Usage: steam app <id>  e.g. steam app 620');\n  } else throw e;\n}","preventionTips":["Extract ids from store URLs with /app\\/(\\d+)/ before calling","Run `steam search` first and use the returned id field","Validate argument counts at the CLI entrypoint","Print the Portal 2 example in usage/help output"],"tags":["validation","argument","steam","missing-argument"],"backgroundTag":"missing-required-argument","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}