{"record":{"id":"b841d6860f39a15f","repo":"jackwener/OpenCLI","slug":"invalid-arg","errorCode":"INVALID_ARG","errorMessage":"--date is not supported for ${period} period","messagePattern":"--date is not supported for (.+?) period","errorType":"error_code","errorClass":"CliError","httpStatus":null,"severity":"error","filePath":"clis/hf/top.js","lineNumber":61,"sourceCode":"        { name: 'period', type: 'str', default: 'daily', choices: ['daily', 'weekly', 'monthly'], help: 'Time period: daily, weekly, or monthly' },\n    ],\n    columns: ['rank', 'id', 'title', 'upvotes', 'authors'],\n    footerExtra: (kwargs) => {\n        if (kwargs._footerDate)\n            return kwargs._footerDate;\n        if (kwargs.period === 'monthly')\n            return getMonthRange();\n        if (kwargs.period === 'weekly')\n            return getWeekRange();\n        return kwargs.date ?? new Date().toISOString().slice(0, 10);\n    },\n    func: async (kwargs) => {\n        const period = String(kwargs.period ?? 'daily');\n        const all = Boolean(kwargs.all);\n        const endpoint = process.env.HF_ENDPOINT?.replace(/\\/+$/, '') || 'https://huggingface.co';\n        if (period === 'weekly' || period === 'monthly') {\n            if (kwargs.date) {\n                throw new CliError('INVALID_ARG', `--date is not supported for ${period} period`, `Omit --date when using --period ${period}`);\n            }\n            const url = `${endpoint}/api/papers?period=${period}`;\n            const res = await fetch(url);\n            if (!res.ok)\n                throw new CliError('FETCH_ERROR', `HF API error: ${res.status} ${res.statusText}`, 'Check HF_ENDPOINT or try again later');\n            const body = await res.json();\n            if (!Array.isArray(body))\n                throw new CliError('FETCH_ERROR', 'Unexpected HF API response', 'Check endpoint');\n            const data = body;\n            const dates = data.map((d) => d.publishedAt).filter(Boolean).sort();\n            if (dates.length > 0) {\n                if (period === 'monthly') {\n                    const d = new Date(dates[0]);\n                    kwargs._footerDate = `${MONTH_ABBR[d.getUTCMonth()]} ${d.getUTCFullYear()}`;\n                }\n                else {\n                    const start = new Date(dates[0]);\n                    const end = new Date(dates[dates.length - 1]);","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/hf/top.js#L43-L79","documentation":"A CliError with code INVALID_ARG thrown by the `hf top` (papers) command when --date is passed together with --period weekly or monthly. The Hugging Face papers API only supports a date parameter for the daily period, so the CLI rejects the invalid combination up front.","triggerScenarios":"Invoking the command like `hf top --period weekly --date 2024-01-15` or `hf top --period monthly --date ...`; any truthy kwargs.date while period is 'weekly' or 'monthly'.","commonSituations":"Users assuming weekly/monthly rankings can be back-dated like daily ones; scripts parameterizing both flags generically; copying the daily invocation and changing only the period.","solutions":["Drop --date and re-run: `hf top --period weekly`","Use the default daily period when a specific date is needed: `hf top --date 2024-01-15`","Update scripts to only pass --date when period is daily/omitted"],"exampleFix":"// before\nawait run(['hf', 'top', '--period', 'weekly', '--date', '2024-01-15']);\n// after\nawait run(['hf', 'top', '--period', 'weekly']);","handlingStrategy":"validation","validationCode":"// validate flag combination before invoking\nfunction validateHfTopArgs(args) {\n  const period = args.period ?? 'daily';\n  if (args.date && (period === 'weekly' || period === 'monthly')) {\n    throw new Error(`--date is not supported with --period ${period}; omit --date`);\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  await run(['hf', 'top', ...flags]);\n} catch (e) {\n  if (String(e.message ?? e).includes('not supported for')) {\n    // drop --date and re-run with the period only\n    return await run(['hf', 'top', '--period', period]);\n  }\n  throw e;\n}","preventionTips":["Remember --date applies only to the daily period","Build CLI flags from a whitelist per period in scripts","Lint CI configs for stray --date flags with weekly/monthly","Read the command's --help before combining flags"],"tags":["argument-validation","cli","huggingface"],"backgroundTag":"invalid-argument-combination","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}