{"record":{"id":"8fdffdcd4d35918c","repo":"gitbutlerapp/gitbutler","slug":"ollama-endpoint-must-use-host-port-format","errorCode":null,"errorMessage":"Ollama endpoint must use host:port format","messagePattern":"Ollama endpoint must use host:port format","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-llm/src/config.rs","lineNumber":417,"sourceCode":"    if value.is_empty() {\n        bail!(\"{field} is required\")\n    }\n    Ok(value)\n}\n\nfn validate_url(value: &str, field: &str) -> Result<()> {\n    let value = required(value, field)?;\n    let url = url::Url::parse(value).with_context(|| format!(\"{field} must be a valid URL\"))?;\n    if !matches!(url.scheme(), \"http\" | \"https\") || url.host_str().is_none() {\n        bail!(\"{field} must be an HTTP or HTTPS URL\")\n    }\n    Ok(())\n}\n\nfn validate_ollama_endpoint(value: &str) -> Result<()> {\n    let value = required(value, \"Ollama endpoint\")?;\n    if value.contains(\"://\") {\n        bail!(\"Ollama endpoint must use host:port format\")\n    }\n    let (host, port) = value\n        .rsplit_once(':')\n        .context(\"Ollama endpoint must use host:port format\")?;\n    if host.trim().is_empty() || port.parse::<u16>().is_err() {\n        bail!(\"Ollama endpoint must use host:port format\")\n    }\n    Ok(())\n}\n\nfn set_optional(config: &mut gix::config::File, key: &str, value: Option<&str>) -> Result<()> {\n    match nonempty(value) {\n        Some(value) => set_config_value(config, key, value),\n        None => remove_config_value(config, key),\n    }\n}\n\n#[cfg(test)]","sourceCodeStart":399,"sourceCodeEnd":435,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-llm/src/config.rs#L399-L435","documentation":"Validation guard in validate_ollama_endpoint: the Ollama endpoint must be a bare host:port address, but the supplied string contained a URL scheme separator (e.g. 'http://'), which the local Ollama client does not accept. Fires during config validation (validate, validate_active) or when applying Ollama configuration; the user should strip the scheme and provide only host:port.","triggerScenarios":"Setting the Ollama endpoint to \"http://localhost:11434\" instead of \"localhost:11434\" and running validate, validate_active, or apply_ollama_configuration.","commonSituations":"Copy-pasting the full Ollama URL from browser/docs into a field that only accepts host:port; mixing conventions with other providers' URL fields.","solutions":["Remove the http:// or https:// prefix from the endpoint","Use host:port form, e.g. localhost:11434","If a hostname without port was intended, append the Ollama default port 11434"],"exampleFix":"// before\nollama.endpoint = \"http://localhost:11434\"\n// after\nollama.endpoint = \"localhost:11434\"","handlingStrategy":"validation","validationCode":"// TS\nconst isHostPort = (v: string) => !v.includes('://') && /^[^:]+:\\d+$/.test(v);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remember Ollama endpoints use host:port, not a URL","Strip schemes when copying from docs or browser","Use the default localhost:11434 unless remote"],"tags":["config","ollama","validation","format"],"backgroundTag":"invalid-config-value","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}