clash-verge-rev/clash-verge-rev · error · Error
Invalid vmess uri
Error message
Invalid vmess uri
What it means
Thrown by URI_VMESS when stripUriScheme returns an empty string — the URI is exactly 'vmess://' with nothing after the scheme. stripUriScheme validates the 'vmess' scheme is present but returns '' if the URI ends at '://' with no content.
Source
Thrown at src/utils/uri-parser/vmess.ts:113
/^"(.*)"$/,
)?.[1] || '/',
headers: {
Host:
params['obfs-header']?.match(/Host:\s*([a-zA-Z0-9-.]*)/)?.[1] || '',
},
}
} else {
throw new Error(`Unsupported obfs: ${params.obfs}`)
}
}
return proxy
}
export function URI_VMESS(line: string): IProxyVmessConfig {
const afterScheme = stripUriScheme(line, 'vmess', 'Invalid vmess uri')
if (!afterScheme) {
throw new Error('Invalid vmess uri')
}
const raw = afterScheme
const content = decodeBase64OrOriginal(raw)
if (/=\s*vmess/.test(content)) {
return parseVmessQuantumult(content)
}
const params = parseVmessParams(content, raw)
const server =
typeof params.add === 'string' ? normalizeHost(params.add) : params.add
const port = parseRequiredPort(params.port, 'Invalid vmess uri: invalid port')
const tlsValue = params.tls
const proxy: IProxyVmessConfig = {
name:
trimStr(params.ps) ??
trimStr(params.remarks) ??
trimStr(params.remark) ??
`VMess ${server}:${port}`,View on GitHub (pinned to 5cad0f2799)
Solutions
- Provide a complete VMess URI: vmess://<base64-encoded-config>
- Filter out scheme-only strings before batch processing
- Validate string length exceeds 'vmess://'.length before calling URI_VMESS
Example fix
// before
URI_VMESS('vmess://')
// after
URI_VMESS('vmess://eyJ2IjoiMiIsInBzIjoiTXlOb2RlIiwiYWRkIjoiMS4yLjMuNCIsInBvcnQiOiI0NDMifQ==') Defensive patterns
Strategy: validation
Validate before calling
function hasVmessContent(uri: string): boolean {
return (uri.startsWith('vmess://') || uri.startsWith('vmess1://')) && uri.length > 'vmess://'.length
} Prevention
- Filter scheme-only lines from subscription lists before parsing
- Validate that the base64 payload exists after 'vmess://'
- Trim whitespace and remove empty entries from input arrays
When it happens
Trigger: Calling URI_VMESS('vmess://') — afterScheme is '' which is falsy. Any URI where 'vmess://' is immediately followed by end-of-string.
Common situations: Empty lines or placeholder entries in subscription files that happen to start with 'vmess://'. Template URIs that weren't populated. Clipboard truncation at the scheme boundary.
Related errors
- Unsupported obfs: ${params.obfs}
- Invalid vless uri
- Invalid vless uri: missing port
- Invalid wireguard uri
- errorMessage
AI-assisted analysis of clash-verge-rev/clash-verge-rev@5cad0f2799 (2026-08-12).
Data as JSON: /api/errors/bbe1b46334b1a772.
Report an issue: GitHub.