mislav/hub · error
%s is must be string but got %#v
Error message
%s is must be string but got %#v
What it means
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.
Source
Thrown at github/config_decoder.go:69
}
host := &Host{Host: hostName}
for _, prop := range v[0].(yaml.MapSlice) {
propName, ok := prop.Key.(string)
if !ok {
return fmt.Errorf("property name is must be string but got %#v", prop.Key)
}
switch propName {
case "user":
host.User, ok = prop.Value.(string)
case "oauth_token":
host.AccessToken, ok = prop.Value.(string)
case "protocol":
host.Protocol, ok = prop.Value.(string)
case "unix_socket":
host.UnixSocket, ok = prop.Value.(string)
}
if !ok {
return fmt.Errorf("%s is must be string but got %#v", propName, prop.Value)
}
}
c.Hosts = append(c.Hosts, host)
}
return nil
}
View on GitHub (pinned to 5c547ed804)
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.
Example fix
// before (token parsed as int) - oauth_token: 1234567890 // after - oauth_token: "1234567890abcdef"
Defensive patterns
Strategy: validation
Validate before calling
var raw map[string][]yaml.MapSlice
yaml.Unmarshal(data, &raw)
for _, entries := range raw {
for _, m := range entries {
for _, p := range m {
if _, ok := p.Value.(string); !ok {
log.Fatalf("property %v must be a quoted string, got %v (%T)", p.Key, p.Value, p.Value)
}
}
}
} Type guard
func isStringPropValue(v interface{}) bool {
_, ok := v.(string)
return ok
} Try / catch
if err := cfg.Decode(data); err != nil {
if strings.Contains(err.Error(), "is must be string but got") {
return fmt.Errorf("quote string property values in hub config: %w", err)
}
return err
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: Numeric OAuth tokens pasted unquoted; YAML booleans from unquoted `yes`/`no`/`true`; hand-edited configs adding wrong-typed values.
Related errors
- host name is must be string but got %#v
- property name is must be string but got %#v
- value of host entry is must be array but got %#v
- Please set $BROWSER to a web launcher
- Error: couldn't detect shell type. Please specify your shell
AI-assisted analysis of mislav/hub@5c547ed804 (2026-09-01).
Data as JSON: /api/errors/1c3858069e86535c.
Report an issue: GitHub.