Skip to content

constant warnings about failed "textDocument/hover" because unauthorized "Failure to retrieve variables" #462

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
qrkourier opened this issue Apr 3, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@qrkourier
Copy link

qrkourier commented Apr 3, 2025

Describe the bug
I get a warning toast whenever my mouse hovers momentarily over some text in a workflow file.

Request textDocument/hover failed.

I'm a maintainer of a project and my GitHub handle that contributes commits is not an administrator of the GitHub repo, so I get an unauthorized response each time the extension queries the GitHub API for the list of GH Actions vars.

To Reproduce
Steps to reproduce the behavior:

  1. login to GitHub with the extension and a user account that's not an administrator of the repo
  2. hover the mouse cursor over any text in a workflow file
  3. See warning toast

Expected behavior
I don't expect to see any warning toasts every time my mouse hovers over text.

Screenshots

Image

Extension Version
v0.27.1

Additional context

[Error - 1:19:16 PM] Unhandled error while validating: Must have admin rights to Repository.
Failure to retrieve variables:  $s [HttpError]: Must have admin rights to Repository.
    at ./extensions/github.vscode-github-actions-0.27.1-universal/dist/server-node.js:2:2789981
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.next (./extensions/github.vscode-github-actions-0.27.1-universal/dist/server-node.js:2:2795499)
    at async ./extensions/github.vscode-github-actions-0.27.1-universal/dist/server-node.js:2:2866525
    at async Da.get (./extensions/github.vscode-github-actions-0.27.1-universal/dist/server-node.js:2:2872517)
    at async ./extensions/github.vscode-github-actions-0.27.1-universal/dist/server-node.js:2:2866440
    at async ./extensions/github.vscode-github-actions-0.27.1-universal/dist/server-node.js:2:2866389
    at async Object.getContext (./extensions/github.vscode-github-actions-0.27.1-universal/dist/server-node.js:2:2866043)
    at async gi (./extensions/github.vscode-github-actions-0.27.1-universal/dist/server-node.js:2:2728718)
    at async ./extensions/github.vscode-github-actions-0.27.1-universal/dist/server-node.js:2:2876175 {
  status: 403,
  response: {
    url: 'https://api.github.com/repos/openziti/ziti/actions/variables?per_page=100',
    status: 403,
    headers: {
      'access-control-allow-origin': '*',
      'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset',
      'content-encoding': 'gzip',
      'content-security-policy': "default-src 'none'",
      'content-type': 'application/json; charset=utf-8',
      date: 'Thu, 03 Apr 2025 17:19:35 GMT',
      'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
      server: 'github.com',
      'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
      'transfer-encoding': 'chunked',
      vary: 'Accept-Encoding, Accept, X-Requested-With',
      'x-accepted-oauth-scopes': '',
      'x-content-type-options': 'nosniff',
      'x-frame-options': 'deny',
      'x-github-api-version-selected': '2022-11-28',
      'x-github-media-type': 'github.v3; format=json',
      'x-github-request-id': 'C12A:188A:36C938:6D5C9B:67EEC327',
      'x-oauth-client-id': 'redacted',
      'x-oauth-scopes': 'repo, workflow',
      'x-ratelimit-limit': '5000',
      'x-ratelimit-remaining': '4948',
      'x-ratelimit-reset': '1743703889',
      'x-ratelimit-resource': 'core',
      'x-ratelimit-used': '52',
      'x-xss-protection': '0'
    },
    data: {
      message: 'Must have admin rights to Repository.',
      documentation_url: 'https://docs.github.com/rest/actions/variables#list-repository-variables',
      status: '403'
    }
  },
  request: {
    method: 'GET',
    url: 'https://api.github.com/repos/openziti/ziti/actions/variables?per_page=100',
    headers: {
      accept: 'application/vnd.github.v3+json',
      'user-agent': 'VS Code GitHub Actions (0.27.1) octokit-rest.js/19.0.7 octokit-core.js/4.1.0 Node.js/20.18.1 (linux; x64)',
      authorization: 'token [REDACTED]'
    },
    request: { hook: [Function: bound bound e] }
  }
}
[Error - 1:19:35 PM] Request textDocument/hover failed.
  Message: Request textDocument/hover failed with message: Must have admin rights to Repository.
  Code: -32603 
@qrkourier
Copy link
Author

Correction: this is an error toast, not a warning toast, so I was unable to avoid the barrage of toasts by suppressing info/warn toasts. This toast is undeniable. Also, Undeniable Toast might be a good band name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Backlog 🗒
Development

No branches or pull requests

1 participant