p0cli: Login: Troubleshooting

Last updated: April 29, 2025

1. “The P0 organization ID is required”

Symptom:

Error: The P0 organization ID is required. Please provide it as an argument or set the P0_ORG environment variable.

Cause:

You ran p0 login without an ORG_ID and haven’t set P0_ORG.

Resolution:

  • Supply your org on the command line:

p0 login my-org-id
  • Or export it once:

export P0_ORG=my-org-id
p0 login

2. “Could not find organization”

Symptom:

Could not find organization

Cause:

The CLI fetched your org’s Firestore doc but didn’t find a matching record.

Resolution:

  1. Verify Org ID matches exactly what your P0 admin provided.

  2. Check Firestore access—if behind a VPN or proxy, ensure outbound HTTPS to your P0 Firestore endpoint is allowed.

  3. Environment mix-up—if you’ve set P0_ORG, unset it or confirm it’s correct:

unset P0_ORG
p0 login correct-org-id

3. “Unsupported login for your organization”

Symptom:

Unsupported login for your organization

Cause:

Your org’s ssoProvider in Firestore isn’t mapped in the CLI’s pluginLoginMap.

Resolution:

  • Confirm Provider: Ask your P0 admin what SSO provider your org uses (Google, Okta, Ping, Microsoft, etc.).

  • CLI Support: The CLI supports

    • google / google-oidc

    • okta

    • ping

    • microsoft / azure-oidc

    • oidc-pkce

  • If yours is custom or missing, ask your admin to enable one of the supported providers or contact support@p0.dev.


4. Browser SSO Flow Won’t Open / Popup Blocked

Symptom:

  • No browser window appears.

  • “Waiting for authentication…” stuck indefinitely.

    Cause:

  • No default browser configured, or $BROWSER isn’t set.

  • Popup blocker preventing the SSO window.

    Resolution:

Set $BROWSER to your preferred browser executable:

export BROWSER=google-chrome
  • Allow pop-ups for the P0 login URL in your browser settings.

  • Headless/server: If you’re SSH’d into a machine without GUI, consider using a local machine or enabling X forwarding.


5. File Permission or Write Errors

Symptom:

Error: EACCES: permission denied, open '/home/user/.p0/config.json'

Cause:

Your home directory or the ~/.p0 folder isn’t writable by your user.

Resolution:

# Ensure ~/.p0 exists and is owned by you
mkdir -p ~/.p0
chown $(whoami) ~/.p0
chmod 700 ~/.p0

Then retry p0 login.


6. Token Expiry / “Please run  p0 login…” Loop

Symptom:

Every command asks you to login again, or you see:

Please run `p0 login <organization>` to use the P0 CLI.

Cause:

Your saved token has expired and couldn’t be auto-refreshed.

Resolution:

  • Clear cached creds and re-login:

p0 logout      # removes both config & identity
p0 login my-org-id
  • Ensure system clock is accurate—OAuth expiry is sensitive to clock skew.


7. “Could not find organization, logging out.”

Symptom:

After completing SSO, you immediately get:

Could not find organization, logging out.

Cause:

You authenticated successfully, but the tenant-access check failed.

Resolution:

  • Confirm your user account is added to the correct P0 tenant.

  • Ask your admin to grant you access or verify you’re logging into the right org slug.


Quick Cleanup & Retry

If you ever get stuck, the easiest way to reset your local state is:

p0 logout
rm -rf ~/.p0
p0 login <your-org-id>

Still having trouble?

Reach out to support@p0.dev with:

  • Your org slug

  • Exact error message and stack trace

  • Whether you’ve set any environment variables (P0_ORG, BROWSER)