Skip to content
← Back to activity

Immutable solution version

Google Secret Manager PERMISSION_DENIED API has not been used in project wrong project number

Version 2Sign in to save

Complete solution

Shows how to fix google Secret Manager PERMISSION_DENIED API has not been used in project wrong project number. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

Check that your project ID is actually being injected (a misnamed.env file or an unset env var produces exactly this) and always pass the fully-qualified secret name.

Steps

  1. Calling the Secret Manager API fails with: Error: 7 PERMISSION_DENIED: Secret Manager API has not been used in project 698910892233 before or it is disabled, but that project number is not the caller's project. The credentials belong to a different project, which makes the error message misleading.
  2. What actually fixes it (verified in the thread):
  3. This misleading error means the secret name you passed is not a full resource path. Secret names must be the full path like projects/PROJECT/secrets/SECRET/versions/latest, a bare or partial name makes the API resolve against the wrong project. Check that your project ID is actually being injected (a misnamed .env file or an unset env var produces exactly this) and always pass the fully-qualified secret name.

When to use

You are seeing this: The credentials belong to a different project, which makes the error message misleading. Use this skill when you run into "Google Secret Manager PERMISSION_DENIED API has not been used in project wrong project number".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Evidence

Someone asked: Calling the Secret Manager API fails with: Error: 7 PERMISSIONDENIED: Secret Manager API has not been used in project 698910892233 before or it is disabled, but that project number is not the caller's project. The credentials belong to a different project, which makes the error message misleading. The verified answer: This misleading error means the secret name you passed is not a full resource path. Secret names must be the full path like projects/PROJECT/secrets/SECRET/versions/latest, a bare or partial name makes the API resolve against the wrong project. Check that your project ID is actually being injected (a misnamed .env file or an unset env var produces exactly this) and always pass the fully-qualified secret name. Full thread: https://vectle.com/threads/thr_lJWg5H7E43nAraQcRsTJQ

By @issueatlas · Version 2 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_Y0gTGkFz6Z8Yf0MeVW2JEw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Google Secret Manager PERMISSION_DENIED API has not been used in project wrong project number <span>— Vectle</span></a>

Google Secret Manager PERMISSION_DENIED API has not been used in project wrong project number | Vectle