{"record":{"id":"94505c5ece24f448","repo":"jackwener/OpenCLI","slug":"dockerhub-label-must-be-maxvalue","errorCode":null,"errorMessage":"dockerhub ${label} must be <= ${maxValue}","messagePattern":"dockerhub (.+?) must be <= (.+?)","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/dockerhub/utils.js","lineNumber":29,"sourceCode":"\n// Docker Hub repository slugs are 2-255 chars, lowercase alphanumerics + `_.-`,\n// optionally prefixed with a Docker Hub user/org of the same charset.\nconst SLUG = /^[a-z0-9][a-z0-9._-]*$/;\n\nexport function requireString(value, label) {\n    const s = String(value ?? '').trim();\n    if (!s) throw new ArgumentError(`dockerhub ${label} cannot be empty`);\n    return s;\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(`dockerhub ${label} must be a positive integer`);\n    }\n    if (n > maxValue) {\n        throw new ArgumentError(`dockerhub ${label} must be <= ${maxValue}`);\n    }\n    return n;\n}\n\n/**\n * Split an image identifier into `{owner, name}`. Bare names use the implicit\n * `library` owner that Docker Hub uses for official images (`nginx` →\n * `library/nginx`).\n */\nexport function parseImage(input) {\n    const raw = String(input ?? '').trim().toLowerCase();\n    if (!raw) {\n        throw new ArgumentError('dockerhub image name is required (e.g. \"nginx\", \"library/nginx\", \"bitnami/redis\")');\n    }\n    const slash = raw.indexOf('/');\n    let owner;\n    let name;\n    if (slash >= 0) {","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/dockerhub/utils.js#L11-L47","documentation":"requireBoundedInt throws this ArgumentError when the numeric argument is a valid positive integer but exceeds the allowed maximum (e.g. limit > 100 for dockerhub search). It caps request sizes to what the Docker Hub API accepts.","triggerScenarios":"Calling dockerhub search with --limit 500 or any value > 100; a config default larger than the command's maxValue.","commonSituations":"Users wanting 'all' results set a huge limit; copying a limit from another tool with a higher cap; programmatically computing page size from a larger dataset.","solutions":["Reduce the limit to <= 100 (the search max)","Paginate using subsequent pages if you need more results","Clamp the value in your script: Math.min(limit, 100)"],"exampleFix":"// before\nconst limit = 500;\ndockerhub search --query nginx --limit 500\n// after\nconst limit = Math.min(500, 100);\ndockerhub search --query nginx --limit 100 // paginate for more","handlingStrategy":"validation","validationCode":"const n = Number(args.limit ?? 25); if (n > 100) throw new Error('--limit must be <= 100');","typeGuard":"function isWithinLimit(v, max) { return typeof v === 'number' && Number.isInteger(v) && v > 0 && v <= max; }","tryCatchPattern":"try { await search(args); } catch (e) { if (e instanceof ArgumentError && e.message.includes('must be <=')) { args.limit = 100; /* clamp and retry */ } else throw e; }","preventionTips":["Clamp limits to the documented max (100) in wrappers","Paginate for larger result sets","Check command --help for the maxValue before scripting"],"tags":["argument-validation","numeric","bounds","dockerhub"],"backgroundTag":"invalid-parameter-value","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}