Summary
internal/logger exposes Debug/Info/Warn/Error/Fatal(msg string, args ...any), which forward to zap's
sugared key/value API (sugar.Warnw, sugar.Errorw, ...). About 20 call sites instead pass a
printf-style format string (%s, %v, %d) with trailing positional args, as if these were
Printf-style helpers. Two bad outcomes result:
- The format verbs are never expanded - the log carries a literal
%s/%v.
- The trailing args are misread as structured key/value pairs. An odd arg count leaves a dangling
key, so zap emits an extra error-level line Ignored key without a value.; an even count
produces nonsensical fields (e.g. a file path used as a field key).
This is the same defect class as the keybinding log flood (#722), which fixed the two worst offenders in
internal/ui/keybinding/registry.go. This issue tracks the remaining sites so the whole class is closed.
Affected call sites (~18 remaining)
internal/ui/keybinding/actions.go: 922, 929, 938, 952, 958, 968, 976 (clipboard-image paths)
internal/app/chat.go: 2284
internal/container/container.go: 421
internal/services/channels/telegram.go: 89, 191, 263, 351
internal/agent/agent_utils.go: 609, 682, 698, 707, 735
Steps to Reproduce
- Exercise any affected path (e.g. paste a clipboard image so
actions.go logs, or hit a telegram
download error).
- Inspect
~/.infer/logs/app-<date>.log: the message contains an unexpanded %s/%v, and odd-arg
sites are followed by an error-level Ignored key without a value. line.
Expected Behavior
Each call uses structured logging, e.g.
logger.Warn("failed to save clipboard image", "path", tmpPath, "error", err) - verbs become fields, no
dangling keys, no spurious error line.
Actual Behavior
Unexpanded format verbs and malformed/duplicated structured fields; odd-arg calls add a spurious zap
error line.
Proposed Fix
- Convert each listed site to structured key/value form.
- Optionally (follow-up): remove the footgun at the source - add explicit
*f printf variants in
internal/logger and/or a golangci-lint rule (e.g. loggercheck) that flags printf-style args passed
to the structured logger, so this cannot regress.
Environment
inference-gateway/cli, main. Related: #722.
Summary
internal/loggerexposesDebug/Info/Warn/Error/Fatal(msg string, args ...any), which forward to zap'ssugared key/value API (
sugar.Warnw,sugar.Errorw, ...). About 20 call sites instead pass aprintf-style format string (
%s,%v,%d) with trailing positional args, as if these werePrintf-style helpers. Two bad outcomes result:%s/%v.key, so zap emits an extra
error-level lineIgnored key without a value.; an even countproduces nonsensical fields (e.g. a file path used as a field key).
This is the same defect class as the keybinding log flood (#722), which fixed the two worst offenders in
internal/ui/keybinding/registry.go. This issue tracks the remaining sites so the whole class is closed.Affected call sites (~18 remaining)
internal/ui/keybinding/actions.go: 922, 929, 938, 952, 958, 968, 976 (clipboard-image paths)internal/app/chat.go: 2284internal/container/container.go: 421internal/services/channels/telegram.go: 89, 191, 263, 351internal/agent/agent_utils.go: 609, 682, 698, 707, 735Steps to Reproduce
actions.gologs, or hit a telegramdownload error).
~/.infer/logs/app-<date>.log: the message contains an unexpanded%s/%v, and odd-argsites are followed by an
error-levelIgnored key without a value.line.Expected Behavior
Each call uses structured logging, e.g.
logger.Warn("failed to save clipboard image", "path", tmpPath, "error", err)- verbs become fields, nodangling keys, no spurious error line.
Actual Behavior
Unexpanded format verbs and malformed/duplicated structured fields; odd-arg calls add a spurious zap
errorline.Proposed Fix
*fprintf variants ininternal/loggerand/or a golangci-lint rule (e.g.loggercheck) that flags printf-style args passedto the structured logger, so this cannot regress.
Environment
inference-gateway/cli,main. Related: #722.