kovidgoyal/kitty · error
could not guess the data type of: %s with error: %w
Error message
could not guess the data type of: %s with error: %w
What it means
When no type signature is supplied, ParseValueWithSignature calls dbus.ParseVariant which must infer the variant type from the string alone. If the string is ambiguous or unparseable (e.g. empty string or malformed GVariant text), inference fails with this error.
Source
Thrown at kittens/desktop_ui/portal.go:243
}
return
}
func ParseValueWithSignature(value, value_type_signature string) (v dbus.Variant, err error) {
var s dbus.Signature
if value_type_signature != "" {
if value_type_signature[0] == '@' {
value_type_signature = value_type_signature[1:]
}
s, err = dbus.ParseSignature(value_type_signature)
if err != nil {
return dbus.Variant{}, fmt.Errorf("%s is not a valid type signature: %w", value_type_signature, err)
}
}
v, err = dbus.ParseVariant(value, s)
if err != nil {
if value_type_signature == "" {
return dbus.Variant{}, fmt.Errorf("could not guess the data type of: %s with error: %w", value, err)
}
return dbus.Variant{}, fmt.Errorf("%s is not a valid value for signature: %#v with error: %w", value, value_type_signature, err)
}
return v, nil
}
func ParseValue(value string) (dbus.Variant, error) {
return ParseValueWithSignature(value, "")
}
type ShowSettingsOptions struct {
AsJson bool
AllowOtherBackends bool
InNamespace []string
}
func fetch_settings(conn *dbus.Conn, namespaces ...string) (ans ReadAllType, err error) {
path := "/" + strings.ToLower(strings.ReplaceAll(DESKTOP_PORTAL_NAME, ".", "/"))View on GitHub (pinned to 6d5d0c4406)
Solutions
- Supply an explicit type signature (e.g. @s, @u) so parsing need not guess
- Quote string values properly per GVariant text format
- For deletion, pass no value/empty value to the set command as documented
Example fix
# before kitten desktop-ui set ns key # after (explicit signature) kitten desktop-ui set ns key --value-type '@s' hello
Defensive patterns
Strategy: validation
Validate before calling
if value == "" {
return errors.New("empty value: supply an explicit type signature")
} Try / catch
if _, err := portal.ParseValue(v); err != nil {
if _, e2 := portal.ParseValueWithSignature(v, "@s"); e2 == nil {
// treat as string
}
} Prevention
- Always pass an explicit signature when the value could be ambiguous
- Quote strings per GVariant text format
When it happens
Trigger: Calling set with a value that GVariant text format cannot auto-type, such as an empty string, bare punctuation, or nested structures without full syntax.
Common situations: Passing an empty value intending a deletion but hitting a code path that still parses; copy-pasting values with smart quotes or missing quotes around strings that need them.
Related errors
- %s is not a valid type signature: %w
- %s is not a valid value for signature: %#v with error: %w
- failed to export interface: %s at object path: %s with error
- failed to export properties with error: %w
- failed to export introspected methods with error: %w
AI-assisted analysis of kovidgoyal/kitty@6d5d0c4406 (2026-08-27).
Data as JSON: /api/errors/82d35182e7047009.
Report an issue: GitHub.