jackwener/OpenCLI · error · ArgumentError
maven version "${version}" is too long (max 200 chars).
Error message
maven version "${version}" is too long (max 200 chars). What it means
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).
Source
Thrown at clis/maven/utils.js:66
}
const [groupId, artifactId, version] = parts;
if (!groupId || !artifactId) {
throw new ArgumentError(`maven coordinate "${value}" is missing groupId or artifactId`);
}
if (groupId.length > 200 || !COORD_TOKEN.test(groupId)) {
throw new ArgumentError(
`maven groupId "${groupId}" is not a valid token`,
'Use letters / digits / "_-." (max 200 chars), starting with a letter or digit.',
);
}
if (artifactId.length > 200 || !COORD_TOKEN.test(artifactId)) {
throw new ArgumentError(
`maven artifactId "${artifactId}" is not a valid token`,
'Use letters / digits / "_-." (max 200 chars), starting with a letter or digit.',
);
}
if (version != null && version.length > 200) {
throw new ArgumentError(`maven version "${version}" is too long (max 200 chars).`);
}
return { groupId, artifactId, version: version ?? null };
}
export async function mavenFetch(url, label) {
let resp;
try {
resp = await fetch(url, { headers: { 'user-agent': UA, accept: 'application/json' } });
}
catch (err) {
throw new CommandExecutionError(
`${label} request failed: ${err?.message ?? err}`,
'Check that search.maven.org is reachable from this network.',
);
}
if (resp.status === 404) {
throw new EmptyResultError(label, `Maven Central returned 404 for ${url}.`);
}View on GitHub (pinned to 49907e53dc)
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.
Example fix
// before
requireCoord(`com.google.guava:guava:${longBlob}`);
// after
requireCoord('com.google.guava:guava:33.0.0-jre'); Defensive patterns
Strategy: validation
Validate before calling
function isValidVersion(v) {
return v == null || (typeof v === 'string' && v.length <= 200);
}
if (!isValidVersion(version)) throw new Error('version too long (max 200 chars)'); Type guard
function isShortVersion(v) {
return v == null || (typeof v === 'string' && v.length <= 200);
} Try / catch
try {
requireCoord(input);
} catch (err) {
console.error(`Version segment invalid: ${err.message}`);
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- maven ${label} cannot be empty
- maven ${label} must be a positive integer
- maven ${label} must be <= ${maxValue}
- maven coordinate is required (e.g. "com.fasterxml.jackson.co
- maven coordinate "${value}" must be "groupId:artifactId" or
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/ca3e71af15452b4d.
Report an issue: GitHub.