{"record":{"id":"58a567e0b2d1f773","repo":"chenhg5/cc-connect","slug":"reasonix-invalid-serve-url-q-w","errorCode":null,"errorMessage":"reasonix: invalid serve_url %q: %w","messagePattern":"reasonix: invalid serve_url %q: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agent/reasonix/reasonix.go","lineNumber":42,"sourceCode":"// Agent drives a remote reasonix serve instance.\ntype Agent struct {\n\tmu       sync.RWMutex\n\tserveURL string // e.g. \"http://localhost:8080\"\n\tworkDir  string // local project directory (for /dir and display)\n\tmode     string // permission mode: \"default\", \"yolo\", \"plan\"\n}\n\n// New creates a Reasonix agent.\n// Required opts key: \"serve_url\".\nfunc New(opts map[string]any) (core.Agent, error) {\n\tserveURL, _ := opts[\"serve_url\"].(string)\n\tserveURL = strings.TrimRight(serveURL, \"/\")\n\t// Strip trailing slashes so path-join never produces \"//submit\".\n\tif serveURL == \"\" {\n\t\treturn nil, fmt.Errorf(\"reasonix: serve_url is required\")\n\t}\n\tif _, err := url.Parse(serveURL); err != nil {\n\t\treturn nil, fmt.Errorf(\"reasonix: invalid serve_url %q: %w\", serveURL, err)\n\t}\n\n\tworkDir, _ := opts[\"work_dir\"].(string)\n\tif workDir == \"\" {\n\t\tworkDir = \".\"\n\t}\n\n\tmode := normalizeMode(opts)\n\n\tslog.Info(\"reasonix: agent created\", \"serve_url\", serveURL, \"work_dir\", workDir, \"mode\", mode)\n\treturn &Agent{\n\t\tserveURL: serveURL,\n\t\tworkDir:  workDir,\n\t\tmode:     mode,\n\t}, nil\n}\n\nfunc normalizeMode(opts map[string]any) string {","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/agent/reasonix/reasonix.go#L24-L60","documentation":"A config-time validation in the reasonix agent factory: the provided serve_url fails URL parsing after trailing-slash normalization. The quoted %q is the rejected value; the agent cannot be built around a malformed endpoint.","triggerScenarios":"Thrown at agent/reasonix/reasonix.go:42 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Correct serve_url to a full valid URL including scheme (http/https)","Remove stray characters or whitespace","Restart cc-connect after fixing config"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}