decolua/9router · error · Error
Invalid host:port:user:pass format
Error message
Invalid host:port:user:pass format
What it means
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.
Source
Thrown at src/app/(dashboard)/dashboard/proxy-pools/page.js:467
const parseProxyLine = (line) => {
const trimmed = line.trim();
if (!trimmed) return null;
if (trimmed.includes("://")) {
const parsed = new URL(trimmed);
const hostLabel = parsed.port ? `${parsed.hostname}:${parsed.port}` : parsed.hostname;
return {
proxyUrl: parsed.toString(),
name: `Imported ${hostLabel}`,
};
}
const parts = trimmed.split(":");
if (parts.length === 4) {
const [host, port, username, password] = parts;
if (!host || !port || !username || !password) {
throw new Error("Invalid host:port:user:pass format");
}
const proxyUrl = `http://${encodeURIComponent(username)}:${encodeURIComponent(password)}@${host}:${port}`;
const parsed = new URL(proxyUrl);
return {
proxyUrl: parsed.toString(),
name: `Imported ${host}:${port}`,
};
}
throw new Error("Unsupported format");
};
const handleBatchImport = async () => {
const lines = batchImportText
.split(/\r?\n/)
.map((line) => line.trim())
.filter(Boolean);View on GitHub (pinned to 90b52e06ff)
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
Example fix
// before
const [host, port, username, password] = parts;
if (!host || !port || !username || !password) {
throw new Error("Invalid host:port:user:pass format");
}
// after — skip/collect bad lines instead of aborting the whole batch
if (!host || !port || !username || !password) {
errors.push(`line ${i + 1}: invalid host:port:user:pass`);
continue;
} Defensive patterns
Strategy: validation
Validate before calling
// validate one line before import
const re = /^[^:\s]+:\d+:[^:]+:[^:]+$/;
if (!re.test(line.trim())) throw new Error("Invalid host:port:user:pass format"); Try / catch
try {
const proxy = parseProxyLine(line);
results.push(proxy);
} catch (err) {
lineErrors.push(`Line ${i + 1}: ${err.message}`);
} Prevention
- 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)
When it happens
Trigger: 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.
Common situations: Copy-pasting proxy lists with missing fields; trailing colons from truncated rows; spreadsheet exports that leave blank cells; whitespace-only segments after manual editing.
Related errors
- Unsupported format
- Input must be a JSON object or array of objects
- Headroom URL must use http or https
- CLIProxyAPI auth JSON is invalid
- Machine ID is required for Cursor API
AI-assisted analysis of decolua/9router@90b52e06ff (2026-08-30).
Data as JSON: /api/errors/d2759d30a2ac40d4.
Report an issue: GitHub.