{"record":{"id":"1c3858069e86535c","repo":"mislav/hub","slug":"s-is-must-be-string-but-got-v","errorCode":null,"errorMessage":"%s is must be string but got %#v","messagePattern":"(.+?) is must be string but got %#v","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"github/config_decoder.go","lineNumber":69,"sourceCode":"\t\t}\n\t\thost := &Host{Host: hostName}\n\t\tfor _, prop := range v[0].(yaml.MapSlice) {\n\t\t\tpropName, ok := prop.Key.(string)\n\t\t\tif !ok {\n\t\t\t\treturn fmt.Errorf(\"property name is must be string but got %#v\", prop.Key)\n\t\t\t}\n\t\t\tswitch propName {\n\t\t\tcase \"user\":\n\t\t\t\thost.User, ok = prop.Value.(string)\n\t\t\tcase \"oauth_token\":\n\t\t\t\thost.AccessToken, ok = prop.Value.(string)\n\t\t\tcase \"protocol\":\n\t\t\t\thost.Protocol, ok = prop.Value.(string)\n\t\t\tcase \"unix_socket\":\n\t\t\t\thost.UnixSocket, ok = prop.Value.(string)\n\t\t\t}\n\t\t\tif !ok {\n\t\t\t\treturn fmt.Errorf(\"%s is must be string but got %#v\", propName, prop.Value)\n\t\t\t}\n\t\t}\n\t\tc.Hosts = append(c.Hosts, host)\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":51,"sourceCodeEnd":77,"githubUrl":"https://github.com/mislav/hub/blob/5c547ed804368763064e51f3990851e267e88edd/github/config_decoder.go#L51-L77","documentation":"After matching a known property name (user, oauth_token, protocol, unix_socket), the decoder asserts the property value is a string. If the value is a number, boolean, list, or map, the assignment fails and Decode returns this error with the property name and the raw value. All four known properties are string-typed on the Host struct.","triggerScenarios":"A host property value that is not a string, e.g. `oauth_token: 12345` (parsed as int), `protocol: true`, or a nested map/list value for user.","commonSituations":"Numeric OAuth tokens pasted unquoted; YAML booleans from unquoted `yes`/`no`/`true`; hand-edited configs adding wrong-typed values.","solutions":["Quote the value so it parses as a string: `oauth_token: \"1234567890abcdef\"`.","Ensure protocol is the string \"https\" or \"http\", not a boolean or number.","Remove unknown/non-string properties; only user, oauth_token, protocol, unix_socket are supported."],"exampleFix":"// before (token parsed as int)\n- oauth_token: 1234567890\n// after\n- oauth_token: \"1234567890abcdef\"","handlingStrategy":"validation","validationCode":"var raw map[string][]yaml.MapSlice\nyaml.Unmarshal(data, &raw)\nfor _, entries := range raw {\n    for _, m := range entries {\n        for _, p := range m {\n            if _, ok := p.Value.(string); !ok {\n                log.Fatalf(\"property %v must be a quoted string, got %v (%T)\", p.Key, p.Value, p.Value)\n            }\n        }\n    }\n}","typeGuard":"func isStringPropValue(v interface{}) bool {\n    _, ok := v.(string)\n    return ok\n}","tryCatchPattern":"if err := cfg.Decode(data); err != nil {\n    if strings.Contains(err.Error(), \"is must be string but got\") {\n        return fmt.Errorf(\"quote string property values in hub config: %w\", err)\n    }\n    return err\n}","preventionTips":["Always quote token/protocol values: oauth_token: \"abc123\", protocol: \"https\"","Never paste numeric tokens unquoted (YAML reads them as ints)","Avoid unquoted yes/no/true values that YAML types as booleans"],"tags":["yaml","configuration","decoding","type-error"],"backgroundTag":"config-schema-validation-failed","analyzedSha":"5c547ed804368763064e51f3990851e267e88edd","analyzedAt":"2026-09-01T03:34:15.525Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}