{"record":{"id":"ca3e71af15452b4d","repo":"jackwener/OpenCLI","slug":"maven-version-version-is-too-long-max-200-ch","errorCode":null,"errorMessage":"maven version \"${version}\" is too long (max 200 chars).","messagePattern":"maven version \"(.+?)\" is too long \\(max 200 chars\\)\\.","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/maven/utils.js","lineNumber":66,"sourceCode":"    }\n    const [groupId, artifactId, version] = parts;\n    if (!groupId || !artifactId) {\n        throw new ArgumentError(`maven coordinate \"${value}\" is missing groupId or artifactId`);\n    }\n    if (groupId.length > 200 || !COORD_TOKEN.test(groupId)) {\n        throw new ArgumentError(\n            `maven groupId \"${groupId}\" is not a valid token`,\n            'Use letters / digits / \"_-.\" (max 200 chars), starting with a letter or digit.',\n        );\n    }\n    if (artifactId.length > 200 || !COORD_TOKEN.test(artifactId)) {\n        throw new ArgumentError(\n            `maven artifactId \"${artifactId}\" is not a valid token`,\n            'Use letters / digits / \"_-.\" (max 200 chars), starting with a letter or digit.',\n        );\n    }\n    if (version != null && version.length > 200) {\n        throw new ArgumentError(`maven version \"${version}\" is too long (max 200 chars).`);\n    }\n    return { groupId, artifactId, version: version ?? null };\n}\n\nexport async function mavenFetch(url, label) {\n    let resp;\n    try {\n        resp = await fetch(url, { headers: { 'user-agent': UA, accept: 'application/json' } });\n    }\n    catch (err) {\n        throw new CommandExecutionError(\n            `${label} request failed: ${err?.message ?? err}`,\n            'Check that search.maven.org is reachable from this network.',\n        );\n    }\n    if (resp.status === 404) {\n        throw new EmptyResultError(label, `Maven Central returned 404 for ${url}.`);\n    }","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/maven/utils.js#L48-L84","documentation":"requireCoord() allows an optional version segment but caps its length at 200 characters. This ArgumentError is thrown when the third colon-separated segment is longer than 200 characters (it is not otherwise pattern-checked).","triggerScenarios":"Calling with a coordinate whose version segment exceeds 200 chars, e.g. 'g:a:' followed by a very long string, an accidentally repeated version range, or a pasted blob of text after the second colon.","commonSituations":"Copy/paste accidents where an entire line or URL is appended after the artifact; programmatic string concatenation with a corrupted version variable; YAML/JSON config where the version field absorbed adjacent lines.","solutions":["Provide a real Maven version string, e.g. 'com.google.guava:guava:33.0.0-jre'.","Check the version variable for concatenation/copy-paste corruption and trim to the actual version.","If the version is intentionally absent, use the 2-segment form 'groupId:artifactId'.","Log/inspect the value being passed to see what is filling the version slot."],"exampleFix":"// before\nrequireCoord(`com.google.guava:guava:${longBlob}`);\n// after\nrequireCoord('com.google.guava:guava:33.0.0-jre');","handlingStrategy":"validation","validationCode":"function isValidVersion(v) {\n  return v == null || (typeof v === 'string' && v.length <= 200);\n}\nif (!isValidVersion(version)) throw new Error('version too long (max 200 chars)');","typeGuard":"function isShortVersion(v) {\n  return v == null || (typeof v === 'string' && v.length <= 200);\n}","tryCatchPattern":"try {\n  requireCoord(input);\n} catch (err) {\n  console.error(`Version segment invalid: ${err.message}`);\n}","preventionTips":["Sanity-check version variables before interpolation (length and content).","Use 2-segment form when you don't need a version.","Log the constructed coordinate when it fails to spot concatenation bugs.","Guard against multi-line config values leaking into the version field."],"tags":["argument-error","maven","input-validation","length-limit"],"backgroundTag":"maven-coordinate-format-invalid","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}