{"record":{"id":"e79c4cd1d2f719b6","repo":"jackwener/OpenCLI","slug":"invalid-novel-id-id-e79c4c","errorCode":null,"errorMessage":"Invalid novel ID: ${id}","messagePattern":"Invalid novel ID: (.+?)","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/pixiv/novel.js","lineNumber":81,"sourceCode":"    url: `https://www.pixiv.net/novel/show.php?id=${identity.novelId}`,\n  };\n}\n\ncli({\n  site: 'pixiv',\n  name: 'novel',\n  access: 'read',\n  description: 'View Pixiv novel metadata (title, author, series, tags, stats)',\n  domain: 'www.pixiv.net',\n  strategy: Strategy.COOKIE,\n  args: [\n    { name: 'id', required: true, positional: true, help: 'Novel ID' },\n  ],\n  columns: ['novel_id', 'title', 'author', 'user_id', 'series_id', 'series_title', 'series_order', 'words', 'characters', 'bookmarks', 'likes', 'views', 'tags', 'created', 'url'],\n  func: async (page, kwargs) => {\n    const id = String(kwargs.id ?? '');\n    if (!/^\\d+$/.test(id)) {\n      throw new ArgumentError(`Invalid novel ID: ${id}`, 'Example: opencli pixiv novel 10588915');\n    }\n    const body = await pixivFetch(page, `/ajax/novel/${id}`, {\n      notFoundMsg: `Novel not found: ${id}`,\n    });\n    return [novelRowFromBody(body, id)];\n  },\n});\n","sourceCodeStart":63,"sourceCodeEnd":89,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/pixiv/novel.js#L63-L89","documentation":"The pixiv novel CLI command validates its positional id argument with /^\\d+$/ before making any network request. Anything other than a pure digit string (empty, alphanumeric, URL pasted, whitespace) raises ArgumentError with a usage hint, since the /ajax/novel/{id} path requires a numeric novel ID.","triggerScenarios":"Running `opencli pixiv novel` with no argument, a URL like https://www.pixiv.net/novel/show.php?id=10588915, an ID containing spaces or letters, or a slug from another Pixiv content type (series, user).","commonSituations":"Users paste the full Pixiv novel URL instead of the numeric ID; shell quoting issues; copying a series ID or user ID by mistake; empty variable expansion in scripts.","solutions":["Extract the numeric part: `opencli pixiv novel 10588915` (digits only)","If you have a full URL, take the id= query parameter or the trailing numeric segment and pass just that","Verify you are using a novel ID, not a series or user ID","In scripts, quote/trim the argument and check it is non-empty before invoking"],"exampleFix":"// before\nopencli pixiv novel https://www.pixiv.net/novel/show.php?id=10588915\n// after\nopencli pixiv novel 10588915","handlingStrategy":"validation","validationCode":"function extractPixivNovelId(input) {\n  const m = String(input).match(/(\\d+)/);\n  const id = m ? m[1] : '';\n  if (!/^\\d+$/.test(id)) throw new Error(`Invalid novel ID: ${input}`);\n  return id;\n}","typeGuard":"function isPixivNovelId(v) {\n  return typeof v === 'string' && /^\\d+$/.test(v);\n}","tryCatchPattern":"try {\n  const rows = await run(['pixiv', 'novel', rawId]);\n} catch (e) {\n  if (e instanceof ArgumentError && e.message.startsWith('Invalid novel ID')) {\n    console.error('Pass digits only, e.g. opencli pixiv novel 10588915');\n  } else throw e;\n}","preventionTips":["Strip the id= query param from pasted Pixiv URLs before invoking","Quote and trim CLI arguments in scripts to avoid empty/whitespace values","Confirm the ID type (novel vs series vs user) before running the command"],"tags":["argument-error","validation","cli-input","pixiv"],"backgroundTag":"invalid-argument-input","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}