Skip to content

[BUG] Structured logger misused printf-style at ~20 call sites (malformed logs) #723

Closed

Description

@edenreich

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:

  1. The format verbs are never expanded - the log carries a literal %s/%v.
  2. 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

  1. Exercise any affected path (e.g. paste a clipboard image so actions.go logs, or hit a telegram
    download error).
  2. 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.

Activity

  1. added
    bug
    on Jul 2, 2026
  2. added theissue type on Jul 2, 2026
  3. moved this to Todo in 2026on Jul 2, 2026
  4. moved this from Todo to Done in 2026on Jul 2, 2026
  5. inference-gateway-releaser commented on Jul 3, 2026

    @inference-gateway-releaser
    Contributor

    🎉 This issue has been resolved in version 0.128.0 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugreleased

    Type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions