{"record":{"id":"0fd6ad7e38f9cc90","repo":"gastownhall/beads","slug":"externaldoltconfig-set-either-socket-or-host-po","errorCode":null,"errorMessage":"ExternalDoltConfig: set either Socket OR (Host, Port), not both","messagePattern":"ExternalDoltConfig: set either Socket OR \\(Host, Port\\), not both","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/configfile/external_dolt_config.go","lineNumber":46,"sourceCode":"\tTLSSkipVerify   bool          `json:\"tls_skip_verify,omitempty\"`\n\tKeepAlivePeriod time.Duration `json:\"keep_alive_period,omitempty\"`\n}\n\nfunc (c ExternalDoltConfig) ResolvedUser() string {\n\tif c.User == \"\" {\n\t\treturn ExternalDoltConfigDefaultUser\n\t}\n\treturn c.User\n}\n\nfunc (c ExternalDoltConfig) Validate() error {\n\thasHost := c.Host != \"\"\n\thasPort := c.Port != 0\n\thasSocket := c.Socket != \"\"\n\n\tswitch {\n\tcase hasSocket && (hasHost || hasPort):\n\t\treturn errors.New(\"ExternalDoltConfig: set either Socket OR (Host, Port), not both\")\n\tcase !hasSocket && !hasHost && !hasPort:\n\t\treturn errors.New(\"ExternalDoltConfig: must set Socket or (Host, Port)\")\n\tcase hasHost && !hasPort:\n\t\treturn errors.New(\"ExternalDoltConfig: Host requires Port\")\n\tcase !hasHost && hasPort:\n\t\treturn errors.New(\"ExternalDoltConfig: Port requires Host\")\n\t}\n\n\tif hasHost && (c.Port < 1 || c.Port > 65535) {\n\t\treturn fmt.Errorf(\"ExternalDoltConfig: Port %d out of range [1, 65535]\", c.Port)\n\t}\n\n\tif hasSocket && !filepath.IsAbs(c.Socket) {\n\t\treturn fmt.Errorf(\"ExternalDoltConfig: Socket %q is not absolute\", c.Socket)\n\t}\n\n\tswitch {\n\tcase c.TLSCert != \"\" && c.TLSKey == \"\":","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/configfile/external_dolt_config.go#L28-L64","documentation":"Each dependency entry must carry a non-empty TargetID and a valid DependencyType; validatePublicCreateDependencies refuses entries missing either with this fixed message. Unlike other checks it does not include the index, so scan request.Dependencies for the offending entry.","triggerScenarios":"ExecuteCreate/ValidatePublicCreateRequest where a Dependencies element has TargetID == \"\" or dependency.Type not matching a known types.DependencyType (Type.IsValid() false); check at public_create.go:168.","commonSituations":"Constructing DependencyInput structs programmatically and forgetting to set Type; deserializing JSON where the type field is named differently and lands as zero value; using a custom/renamed dependency type string not in the valid set.","solutions":["Set both TargetID and a valid Type (e.g. types.DepBlocks, DepRelated, DepParentChild, DepWaitsFor) on every dependency entry.","Check the JSON/struct field name mapping so Type is actually populated.","Validate entries in a loop before calling ExecuteCreate, mirroring dependency.Type.IsValid()."],"exampleFix":"// before\nreq.Dependencies = append(req.Dependencies, publicops.DependencyInput{TargetID: \"bd-2\"}) // Type unset\n// after\nreq.Dependencies = append(req.Dependencies, publicops.DependencyInput{TargetID: \"bd-2\", Type: types.DepBlocks})","handlingStrategy":"validation","validationCode":"for _, d := range req.Dependencies {\n    if d.TargetID == \"\" || !d.Type.IsValid() { return errors.New(\"dependency target and type are required\") }\n}","typeGuard":"func depValid(d publicops.DependencyInput) bool { return d.TargetID != \"\" && d.Type.IsValid() }","tryCatchPattern":"if err := store.ExecuteCreate(ctx, req); err != nil {\n    if errors.Is(err, storage.ErrValidation) && strings.Contains(err.Error(), \"target and type are required\") { /* fix inputs */ }\n    return err\n}","preventionTips":["Always set Type explicitly on DependencyInput — never rely on zero values.","Check struct tag/JSON field names when deserializing dependencies.","Only use types.DependencyType constants, not raw strings."],"tags":["go","validation","dependencies","required-fields"],"backgroundTag":"missing-required-field","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}