{"record":{"id":"bbe1b46334b1a772","repo":"clash-verge-rev/clash-verge-rev","slug":"invalid-vmess-uri","errorCode":null,"errorMessage":"Invalid vmess uri","messagePattern":"Invalid vmess uri","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/utils/uri-parser/vmess.ts","lineNumber":113,"sourceCode":"            /^\"(.*)\"$/,\n          )?.[1] || '/',\n        headers: {\n          Host:\n            params['obfs-header']?.match(/Host:\\s*([a-zA-Z0-9-.]*)/)?.[1] || '',\n        },\n      }\n    } else {\n      throw new Error(`Unsupported obfs: ${params.obfs}`)\n    }\n  }\n\n  return proxy\n}\n\nexport function URI_VMESS(line: string): IProxyVmessConfig {\n  const afterScheme = stripUriScheme(line, 'vmess', 'Invalid vmess uri')\n  if (!afterScheme) {\n    throw new Error('Invalid vmess uri')\n  }\n  const raw = afterScheme\n  const content = decodeBase64OrOriginal(raw)\n  if (/=\\s*vmess/.test(content)) {\n    return parseVmessQuantumult(content)\n  }\n\n  const params = parseVmessParams(content, raw)\n  const server =\n    typeof params.add === 'string' ? normalizeHost(params.add) : params.add\n  const port = parseRequiredPort(params.port, 'Invalid vmess uri: invalid port')\n  const tlsValue = params.tls\n  const proxy: IProxyVmessConfig = {\n    name:\n      trimStr(params.ps) ??\n      trimStr(params.remarks) ??\n      trimStr(params.remark) ??\n      `VMess ${server}:${port}`,","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/clash-verge-rev/clash-verge-rev/blob/5cad0f2799e74b1105e133bcfc2a45f5c1370ef1/src/utils/uri-parser/vmess.ts#L95-L131","documentation":"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.","triggerScenarios":"Calling URI_VMESS('vmess://') — afterScheme is '' which is falsy. Any URI where 'vmess://' is immediately followed by end-of-string.","commonSituations":"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.","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"],"exampleFix":"// before\nURI_VMESS('vmess://')\n// after\nURI_VMESS('vmess://eyJ2IjoiMiIsInBzIjoiTXlOb2RlIiwiYWRkIjoiMS4yLjMuNCIsInBvcnQiOiI0NDMifQ==')","handlingStrategy":"validation","validationCode":"function hasVmessContent(uri: string): boolean {\n  return (uri.startsWith('vmess://') || uri.startsWith('vmess1://')) && uri.length > 'vmess://'.length\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["uri-parser","vmess","proxy","validation"],"analyzedSha":"5cad0f2799e74b1105e133bcfc2a45f5c1370ef1","analyzedAt":"2026-08-12T03:25:57.699Z","schemaVersion":2},"datasetVersion":"2026-08-12T08:17:17.861Z"}