{"record":{"id":"d2759d30a2ac40d4","repo":"decolua/9router","slug":"invalid-host-port-user-pass-format","errorCode":null,"errorMessage":"Invalid host:port:user:pass format","messagePattern":"Invalid host:port:user:pass format","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/app/(dashboard)/dashboard/proxy-pools/page.js","lineNumber":467,"sourceCode":"\n  const parseProxyLine = (line) => {\n    const trimmed = line.trim();\n    if (!trimmed) return null;\n\n    if (trimmed.includes(\"://\")) {\n      const parsed = new URL(trimmed);\n      const hostLabel = parsed.port ? `${parsed.hostname}:${parsed.port}` : parsed.hostname;\n      return {\n        proxyUrl: parsed.toString(),\n        name: `Imported ${hostLabel}`,\n      };\n    }\n\n    const parts = trimmed.split(\":\");\n    if (parts.length === 4) {\n      const [host, port, username, password] = parts;\n      if (!host || !port || !username || !password) {\n        throw new Error(\"Invalid host:port:user:pass format\");\n      }\n\n      const proxyUrl = `http://${encodeURIComponent(username)}:${encodeURIComponent(password)}@${host}:${port}`;\n      const parsed = new URL(proxyUrl);\n      return {\n        proxyUrl: parsed.toString(),\n        name: `Imported ${host}:${port}`,\n      };\n    }\n\n    throw new Error(\"Unsupported format\");\n  };\n\n  const handleBatchImport = async () => {\n    const lines = batchImportText\n      .split(/\\r?\\n/)\n      .map((line) => line.trim())\n      .filter(Boolean);","sourceCodeStart":449,"sourceCodeEnd":485,"githubUrl":"https://github.com/decolua/9router/blob/90b52e06ffd666b7929554211474d01588f6b1f8/src/app/(dashboard)/dashboard/proxy-pools/page.js#L449-L485","documentation":"ProxyPoolsPage's batch-import parser throws this when a line splits into exactly 4 colon-separated parts but any of host, port, username, or password is empty. It is a per-line validation guard converting `host:port:user:pass` into an authenticated proxy URL.","triggerScenarios":"Batch import line like `:8080:user:pass`, `host::user:pass`, `host:port::pass`, or `host:port:user:` — four segments present but at least one empty after trimming.","commonSituations":"Copy-pasting proxy lists with missing fields; trailing colons from truncated rows; spreadsheet exports that leave blank cells; whitespace-only segments after manual editing.","solutions":["Supply all four fields host:port:user:pass with no empty segment","Remove trailing/leading colons from the line","Validate each line before submitting (regex like /^[^:\\s]+:\\d+:[^:]*:[^:]*$/ with non-empty groups)","Check the source list for rows where credentials were redacted or lost"],"exampleFix":"// before\nconst [host, port, username, password] = parts;\nif (!host || !port || !username || !password) {\n  throw new Error(\"Invalid host:port:user:pass format\");\n}\n// after — skip/collect bad lines instead of aborting the whole batch\nif (!host || !port || !username || !password) {\n  errors.push(`line ${i + 1}: invalid host:port:user:pass`);\n  continue;\n}","handlingStrategy":"validation","validationCode":"// validate one line before import\nconst re = /^[^:\\s]+:\\d+:[^:]+:[^:]+$/;\nif (!re.test(line.trim())) throw new Error(\"Invalid host:port:user:pass format\");","typeGuard":null,"tryCatchPattern":"try {\n  const proxy = parseProxyLine(line);\n  results.push(proxy);\n} catch (err) {\n  lineErrors.push(`Line ${i + 1}: ${err.message}`);\n}","preventionTips":["Ensure all four fields are present and non-empty on every line","Strip trailing colons and whitespace from pasted lists","Validate the whole batch and report per-line errors instead of aborting","Source lists from exports that keep credentials intact (no redaction)"],"tags":["validation","proxy","parsing","batch-import"],"backgroundTag":"invalid-proxy-format","analyzedSha":"90b52e06ffd666b7929554211474d01588f6b1f8","analyzedAt":"2026-08-30T21:05:45.952Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}