{"record":{"id":"357d33901e62e4bd","repo":"jackwener/OpenCLI","slug":"tieba-search-currently-only-supports-page-max","errorCode":null,"errorMessage":"tieba search currently only supports --page ${MAX_SUPPORTED_PAGE}","messagePattern":"tieba search currently only supports --page (.+?)","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/tieba/search.js","lineNumber":79,"sourceCode":"    })()\n  `;\n}\n/**\n * Normalize CLI args into the concrete search page URL.\n */\nfunction getSearchUrl(kwargs) {\n    const keyword = String(kwargs.keyword || '');\n    const pageNumber = Number(kwargs.page || 1);\n    return `https://tieba.baidu.com/f/search/res?qw=${encodeURIComponent(keyword)}&ie=utf-8&pn=${pageNumber}`;\n}\n/**\n * Tieba's current desktop search UI no longer exposes a reliable browser-page transition.\n */\nfunction assertSupportedPage(kwargs) {\n    const pageNumber = String(kwargs.page || 1);\n    if (pageNumber === MAX_SUPPORTED_PAGE)\n        return;\n    throw new ArgumentError(`tieba search currently only supports --page ${MAX_SUPPORTED_PAGE}`, `Baidu Tieba search no longer exposes stable browser pagination; omit --page or use --page ${MAX_SUPPORTED_PAGE}`);\n}\ncli({\n    site: 'tieba',\n    name: 'search',\n    access: 'read',\n    description: 'Search posts across tieba',\n    domain: 'tieba.baidu.com',\n    strategy: Strategy.COOKIE,\n    browser: true,\n    navigateBefore: false,\n    args: [\n        { name: 'keyword', positional: true, required: true, type: 'string', help: 'Search keyword' },\n        // Restrict unsupported pages before the browser session starts.\n        { name: 'page', type: 'int', default: 1, choices: ['1'], help: 'Page number (currently only 1 is supported)' },\n        { name: 'limit', type: 'int', default: 20, help: 'Number of items to return' },\n    ],\n    columns: ['rank', 'id', 'title', 'forum', 'author', 'time', 'url'],\n    func: async (page, kwargs) => {","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/tieba/search.js#L61-L97","documentation":"`tieba search` supports only one fixed page (`MAX_SUPPORTED_PAGE`) because Baidu Tieba's desktop search UI no longer offers stable browser pagination. `assertSupportedPage` runs before the search and throws an ArgumentError for any `--page` value other than that single supported value. This is a deliberate API restriction, not a transient failure.","triggerScenarios":"Calling `tieba search --query <q> --page N` (or kwargs.page) where the stringified page differs from MAX_SUPPORTED_PAGE — e.g. `--page 2`, `--page 3`, or any value other than the allowed one; omitting --page defaults to 1 and likewise throws unless MAX_SUPPORTED_PAGE is '1'.","commonSituations":"Scripts written when real pagination existed; developers assuming Google-like pagination semantics; loops that increment --page to fetch more results.","solutions":["Omit the --page flag entirely so the search uses its single supported page.","Use the documented value exactly: `--page <MAX_SUPPORTED_PAGE>` as stated in the error hint.","To get more results, refine the query (tighter keywords, forum filter) or paginate via different query terms instead of --page.","Check the installed library version — newer releases may restore pagination; upgrade if available."],"exampleFix":"// before\nawait cli.search({ query: 'linux', page: 3 }); // ArgumentError\n// after\nawait cli.search({ query: 'linux' }); // omit --page\n// or, if you need more results:\nawait cli.search({ query: 'linux kernel config' });","handlingStrategy":"validation","validationCode":"// assert supported page before invoking tieba search\nconst ALLOWED_PAGE = 1; // MAX_SUPPORTED_PAGE\nif (page !== undefined && page !== ALLOWED_PAGE) {\n  throw new Error(`tieba search only supports --page ${ALLOWED_PAGE}`);\n}","typeGuard":"function isSupportedSearchPage(page) {\n  return page === undefined || page === 1; // matches MAX_SUPPORTED_PAGE\n}","tryCatchPattern":"try {\n  return await cli.search({ query, page });\n} catch (e) {\n  if (/only supports --page/.test(e.message)) {\n    return cli.search({ query }); // drop --page and retry\n  }\n  throw e;\n}","preventionTips":["Never pass --page to tieba search; treat pagination as unsupported.","Refine the query instead of paginating to get more results.","Centralize allowed-parameter checks in your wrapper around the CLI.","Read the command description before building loops over --page."],"tags":["tieba","search","unsupported-parameter","pagination"],"backgroundTag":"unsupported-parameter-value","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}