{"record":{"id":"c3fe48a61fa3a4f9","repo":"AlexxIT/go2rtc","slug":"hap-can-t-read-value-v","errorCode":null,"errorMessage":"hap: can't read value: %v","messagePattern":"hap: can't read value: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/hap/character.go","lineNumber":133,"sourceCode":"\t\tc.Value, err = tlv8.MarshalBase64(v)\n\n\tcase \"bool\":\n\t\tswitch v := v.(type) {\n\t\tcase bool:\n\t\t\tc.Value = v\n\t\tcase float64:\n\t\t\tc.Value = v != 0\n\t\t}\n\t}\n\treturn\n}\n\n// ReadTLV8 value to right struct\nfunc (c *Character) ReadTLV8(v any) (err error) {\n\tif s, ok := c.Value.(string); ok {\n\t\treturn tlv8.UnmarshalBase64(s, v)\n\t}\n\treturn fmt.Errorf(\"hap: can't read value: %v\", v)\n}\n\nfunc (c *Character) ReadBool() (bool, error) {\n\tif v, ok := c.Value.(bool); ok {\n\t\treturn v, nil\n\t}\n\treturn false, fmt.Errorf(\"hap: can't read value: %v\", c.Value)\n}\n\nfunc (c *Character) String() string {\n\tdata, err := json.Marshal(c)\n\tif err != nil {\n\t\treturn \"ERROR\"\n\t}\n\treturn string(data)\n}\n","sourceCodeStart":115,"sourceCodeEnd":150,"githubUrl":"https://github.com/AlexxIT/go2rtc/blob/c245815e75e2a5fd60b4290f12bfc04e55a984d3/pkg/hap/character.go#L115-L150","documentation":"ReadTLV8 requires the character's stored Value to be a base64 TLV8 string, but it holds a different type, so it cannot unmarshal into the target struct. Raised both in ReadTLV8 and ReadBool when the HAP characteristic value has an unexpected type.","triggerScenarios":"Thrown at pkg/hap/character.go:133 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read the characteristic as its actual type (e.g. ReadBool) instead of TLV8","Ensure the characteristic was populated from a TLV8/base64 source before calling ReadTLV8"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"c245815e75e2a5fd60b4290f12bfc04e55a984d3","analyzedAt":"2026-09-07T11:47:02.965Z","contentChangedAt":"2026-09-07T11:47:02.965Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}