{"record":{"id":"d709e8335cd1266a","repo":"crowdsecurity/crowdsec","slug":"invalid-victorialogs-url-q-w","errorCode":null,"errorMessage":"invalid VictoriaLogs URL %q: %w","messagePattern":"invalid VictoriaLogs URL %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/acquisition/modules/victorialogs/internal/vlclient/vl_client.go","lineNumber":55,"sourceCode":"\tURL     string\n\tPrefix  string\n\tQuery   string\n\tHeaders map[string]string\n\n\tUsername string\n\tPassword string\n\n\tSince time.Duration\n\n\tFailMaxDuration time.Duration\n\n\tLimit int\n}\n\nfunc updateURI(uri string, newStart time.Time) (string, error) {\n\tu, err := url.Parse(uri)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"invalid VictoriaLogs URL %q: %w\", uri, err)\n\t}\n\n\tqueryParams := u.Query()\n\n\tif !newStart.IsZero() {\n\t\t// +1 the last timestamp to avoid getting the same result again.\n\t\tupdatedStart := newStart.Add(1 * time.Nanosecond)\n\t\tqueryParams.Set(\"start\", updatedStart.Format(time.RFC3339Nano))\n\t}\n\n\tu.RawQuery = queryParams.Encode()\n\n\treturn u.String(), nil\n}\n\nfunc (lc *VLClient) SetTomb(t *tomb.Tomb) {\n\tlc.t = t\n}","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/modules/victorialogs/internal/vlclient/vl_client.go#L37-L73","documentation":"updateURI rewrites the stored query URI to shift the start time for the next VictoriaLogs query range request. It first calls url.Parse on the configured URI; if the URI is malformed the parse error is wrapped with \"invalid VictoriaLogs URL\". Normally the URI was already validated at configuration time, so hitting this indicates a corrupted or hand-edited URI.","triggerScenarios":"doQueryRange calls updateURI with a URI that url.Parse rejects — e.g. a DSN base URL with invalid characters (unescaped spaces, stray control characters) or a malformed scheme/colon placement.","commonSituations":"Misconfigured URL in acquis.yaml containing spaces or invalid characters, proxy URLs pasted with surrounding whitespace, or unusual characters that need percent-encoding.","solutions":["Fix the URL in the DSN/acquis.yaml so it is a valid absolute URL (scheme://host[:port][/path])","Percent-encode spaces and special characters (e.g. %20) or remove them","Validate the URL with a quick `url.Parse` snippet or any URL validator before deploying","Re-run cscli/crowdsec config validation to catch it at load time"],"exampleFix":"// before\nurl: victorialogs+http://127.0.0.1:8428/my path/\n// after\nurl: victorialogs+http://127.0.0.1:8428/my%20path/","handlingStrategy":"validation","validationCode":"try { new URL(uri.replace(/^victorialogs\\+/, \"\")) } catch (e) {\n  throw new Error(`invalid VictoriaLogs URL: ${uri}`)\n}","typeGuard":null,"tryCatchPattern":"try {\n  await startAcquisition(cfg)\n} catch (e) {\n  if (String(e).includes(\"invalid VictoriaLogs URL\")) {\n    log.error(\"Fix the URL in acquis.yaml:\", e.message)\n  }\n}","preventionTips":["Percent-encode spaces and special characters in URLs","Keep the URL on one line in acquis.yaml — no wrapped whitespace","Test the URL with curl before adding it to config"],"tags":["url","victorialogs","parsing"],"backgroundTag":"invalid-url-format","analyzedSha":"909b5157986a2b2c2163300fdaef5ed01289f7d2","analyzedAt":"2026-09-06T12:27:26.012Z","contentChangedAt":"2026-09-06T12:27:26.012Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}