Skip to content

Vault Plugin: Fix incorrect error logging#21590

Open
prashantkumar1982 wants to merge 2 commits intodevelopfrom
plugin_err_logging
Open

Vault Plugin: Fix incorrect error logging#21590
prashantkumar1982 wants to merge 2 commits intodevelopfrom
plugin_err_logging

Conversation

@prashantkumar1982
Copy link
Contributor

@prashantkumar1982 prashantkumar1982 commented Mar 18, 2026

Vault plugin request validation paths were logging expected user input failures as errors. In particular, observeGetSecretsRequest() can return newUserError("key does not exist"), but the caller logged it with Errorw, which creates noisy error logs for normal user mistakes.

This change downgrades userError cases to debug logs while preserving error-level logging for actual internal failures. The same behavior is now applied consistently across get/create/update/delete handling in both observation and state-transition code paths, so user-facing validation failures still propagate back in responses but no longer appear as server errors in logs.

I used Codex for the fix.

My prompt:
`In folder chainlink, file core/services/ocr2/plugins/vault/plugin.go, line 526 is error log saying this:
failed to observe get secret request item
However the method that returns error, observeGetSecretsRequest() could return a user error too.
We want to not log an error log if the return was a user error. Instead do a debug log.
Specifically the error returned is this: newUserError("key does not exist")

Could you fix that, and also fix other similar pattern in this same file?`

@prashantkumar1982 prashantkumar1982 changed the title Fix error logs in vault plugin Vault Plugin: Fix incorrect error logging Mar 18, 2026
@github-actions
Copy link
Contributor

I see you updated files related to core. Please run make gocs in the root directory to add a changeset as well as in the text include at least one of the following tags:

  • #added For any new functionality added.
  • #breaking_change For any functionality that requires manual action for the node to boot.
  • #bugfix For bug fixes.
  • #changed For any change to the existing functionality.
  • #db_update For any feature that introduces updates to database schema.
  • #deprecation_notice For any upcoming deprecation functionality.
  • #internal For changesets that need to be excluded from the final changelog.
  • #nops For any feature that is NOP facing and needs to be in the official Release Notes for the release.
  • #removed For any functionality/config that is removed.
  • #updated For any functionality that is updated.
  • #wip For any change that is not ready yet and external communication about it should be held off till it is feature complete.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 18, 2026

✅ No conflicts with other open PRs targeting develop

@prashantkumar1982 prashantkumar1982 marked this pull request as ready for review March 18, 2026 19:19
@prashantkumar1982 prashantkumar1982 requested review from a team as code owners March 18, 2026 19:19
@cl-sonarqube-production
Copy link

@trunk-io
Copy link

trunk-io bot commented Mar 18, 2026

Static BadgeStatic BadgeStatic BadgeStatic Badge

View Full Report ↗︎Docs

return
}

l.Errorw(msg, keysAndValues...)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logging from a helper can be problematic because the caller info is wrong. There is a logger func Helper to offset the stack though

@prashantkumar1982 prashantkumar1982 added this pull request to the merge queue Mar 19, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants