{"record":{"id":"77484d03fee8b3f0","repo":"amir20/dozzle","slug":"invalid-agent-endpoint-s","errorCode":null,"errorMessage":"invalid agent endpoint: %s","messagePattern":"invalid agent endpoint: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/agent/client.go","lineNumber":91,"sourceCode":"\t}\n\n\tclient := pb.NewAgentServiceClient(conn)\n\n\treturn &Client{\n\t\tclient:       client,\n\t\tconn:         conn,\n\t\tendpoint:     endpoint,\n\t\tnameOverride: nameOverride,\n\t\tgroup:        group,\n\t}, nil\n}\n\n// ParseEndpoint splits an agent endpoint of the form \"address|name|group\" into\n// its parts. Name and group are optional; address is required.\nfunc ParseEndpoint(endpoint string) (string, string, string, error) {\n\tparts := strings.Split(endpoint, \"|\")\n\tif len(parts) > 3 || parts[0] == \"\" {\n\t\treturn \"\", \"\", \"\", fmt.Errorf(\"invalid agent endpoint: %s\", endpoint)\n\t}\n\n\tname := \"\"\n\tif len(parts) >= 2 {\n\t\tname = parts[1]\n\t}\n\n\tgroup := \"\"\n\tif len(parts) == 3 {\n\t\tgroup = parts[2]\n\t}\n\n\treturn parts[0], name, group, nil\n}\n\nfunc rpcErrToErr(err error) error {\n\tif err == nil {\n\t\treturn nil","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/amir20/dozzle/blob/d9463cbe21874e44ab79db6fa63e746ca7d22928/internal/agent/client.go#L73-L109","documentation":"ParseEndpoint returns \"invalid agent endpoint: %s\" when an endpoint string of the form \"address|name|group\" has more than 3 pipe-separated parts or an empty address. The address is mandatory; name and group are optional extras.","triggerScenarios":"agent.NewClient or agent.Hosts receives an endpoint string where strings.Split(e, \"|\") yields >3 parts, or the first part (address) is empty, e.g. \"|Agent\", \"a|b|c|d\", or \"\".","commonSituations":"Multi-host config env var (DOZZLE_REMOTE_AGENT / agent hosts list) with a trailing or doubled pipe like \"host:7007|Agent|\" is fine but \"host:7007|||x\" is not; leading pipe after an empty host; copy-paste adding a name containing a '|' character.","solutions":["Correct the endpoint to \"address\", \"address|name\", or \"address|name|group\" with exactly one non-empty address","Remove any '|' characters from agent display names or groups, or escape/rename them","Check the DOZZLE_REMOTE_AGENT env/label value for stray separators, whitespace, or empty entries before passing them to NewClient","Validate each endpoint with agent.ParseEndpoint at config load time and fail fast with a clear message"],"exampleFix":"// before\nendpoint := \"agent:7007||Team|Prod\" // 4 parts\nclient, err := agent.NewClient(endpoint, certs)\n// after\nendpoint := \"agent:7007|Team|Prod\"\nclient, err := agent.NewClient(endpoint, certs)","handlingStrategy":"validation","validationCode":"parts := strings.Split(endpoint, \"|\")\nif len(parts) > 3 || parts[0] == \"\" {\n    return fmt.Errorf(\"endpoint must be address[|name[|group]], got %q\", endpoint)\n}","typeGuard":"func validAgentEndpoint(e string) bool { _, _, _, err := agent.ParseEndpoint(e); return err == nil }","tryCatchPattern":"addr, name, group, err := agent.ParseEndpoint(cfg.AgentEndpoint)\nif err != nil { log.Fatal().Err(err).Msg(\"fix DOZZLE_REMOTE_AGENT format: address|name|group\") }","preventionTips":["Keep display names free of '|' characters","Trim whitespace and drop empty entries from multi-host config lists before parsing","Validate all configured endpoints at startup instead of lazily at connect time"],"tags":["go","configuration","agent","parsing"],"backgroundTag":"invalid-argument-format","analyzedSha":"d9463cbe21874e44ab79db6fa63e746ca7d22928","analyzedAt":"2026-09-07T10:08:55.855Z","contentChangedAt":"2026-09-07T10:08:55.855Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}