{"record":{"id":"71ee4092ba10a3fe","repo":"jackwener/OpenCLI","slug":"dockerhub-image-input-is-not-a-valid-reposito","errorCode":null,"errorMessage":"dockerhub image \"${input}\" is not a valid repository slug. Use lowercase letters / digits / \"._-\", optionally prefixed with \"<owner>/\".","messagePattern":"dockerhub image \"(.+?)\" is not a valid repository slug\\. Use lowercase letters / digits / \"\\._-\", optionally prefixed with \"<owner>/\"\\.","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/dockerhub/utils.js","lineNumber":56,"sourceCode":" */\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) {\n        owner = raw.slice(0, slash);\n        name = raw.slice(slash + 1);\n    }\n    else {\n        owner = 'library';\n        name = raw;\n    }\n    if (!SLUG.test(owner) || !SLUG.test(name)) {\n        throw new ArgumentError(\n            `dockerhub image \"${input}\" is not a valid repository slug`,\n            'Use lowercase letters / digits / \"._-\", optionally prefixed with \"<owner>/\".',\n        );\n    }\n    if (name.length < 2 || name.length > 255) {\n        throw new ArgumentError(\n            `dockerhub image \"${input}\" name must be 2-255 chars`,\n        );\n    }\n    return { owner, name };\n}\n\nexport async function hubFetch(url, label) {\n    let resp;\n    try {\n        resp = await fetch(url, { headers: { 'user-agent': UA, accept: 'application/json' } });\n    }\n    catch (err) {","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/dockerhub/utils.js#L38-L74","documentation":"parseImage validates each slug segment against /​^[a-z0-9][a-z0-9._-]*$/ and throws this ArgumentError if the owner or name contains invalid characters (uppercase, spaces, tags like ':latest', registry prefixes, etc.).","triggerScenarios":"Passing 'NGINX' (uppercase), 'my image', 'nginx:1.25' (tag included), 'docker.io/library/nginx' (registry prefix), or 'nginx/' with an empty segment.","commonSituations":"Pasting a full image reference including registry host or tag; users typing image names with capitals; stripping owner but leaving the slash.","solutions":["Lowercase the name and drop the tag/digest: 'nginx:1.25' -> 'nginx'","Remove registry prefixes: 'docker.io/library/nginx' -> 'library/nginx'","Keep only [a-z0-9._-] characters, optionally with '<owner>/' prefix","Normalize input in your script before calling the CLI"],"exampleFix":"// before\ndockerhub info --image 'NGINX:latest'\n// after\ndockerhub info --image 'nginx'","handlingStrategy":"validation","validationCode":"const SLUG = /^[a-z0-9][a-z0-9._-]*$/; const raw = args.image.trim().toLowerCase().replace(/^docker\\.io\\//,'').split(':')[0]; const [owner, name = 'library'] = raw.includes('/') ? raw.split('/') : ['library', raw]; if (!SLUG.test(owner) || !SLUG.test(name)) throw new Error(`invalid slug: ${args.image}`);","typeGuard":"function isValidSlug(s) { return typeof s === 'string' && /^[a-z0-9][a-z0-9._-]*$/.test(s); }","tryCatchPattern":"try { await info(args); } catch (e) { if (e instanceof ArgumentError && e.message.includes('not a valid repository slug')) { console.error('Normalize the image ref: lowercase, no tag, no registry prefix'); process.exitCode = 2; } else throw e; }","preventionTips":["Normalize image refs: lowercase, strip tag/digest and registry host","Split owner and name on '/' before passing","Reject uppercase/space input at the script boundary"],"tags":["argument-validation","image-parsing","validation","dockerhub"],"backgroundTag":"invalid-parameter-value","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}