> ## Documentation Index
> Fetch the complete documentation index at: https://anaconda.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Troubleshooting

export const TroubleshootSolution = ({children}) => <>
    <hr className="my-3 w-full" />
    <details className="mt-3">
      <summary className="cursor-pointer font-semibold text-base mb-1">
        Solution
      </summary>
      <div className="mt-2 ml-4" data-component-part="step-content">
        {children}
      </div>
    </details>
  </>;

export const TroubleshootCause = ({children}) => <details className="mt-3 mb-2">
    <summary className="cursor-pointer font-semibold text-base mb-1">
      Cause
    </summary>
    <div className="mt-2 ml-4" data-component-part="step-content">
      {children}
    </div>
  </details>;

export const TroubleshootTitle = ({children}) => <>
    <p className="m-0 font-semibold text-xl leading-tight mb-2" role="heading" aria-level={3}>
      {children}
    </p>
    <hr className="my-3 w-full" />
  </>;

export const Troubleshoot = ({children}) => <div className="callout my-4 px-5 py-4 overflow-hidden rounded-2xl flex gap-3 border troubleshoot-admonition dark:troubleshoot-admonition" data-callout-type="troubleshoot">
    <div className="mt-0.5 w-4">
      <svg width="14" height="14" viewBox="0 0 640 640" fill="currentColor" className="w-4 h-4" aria-label="Troubleshoot">
        <path d="M541.4 162.6C549 155 561.7 156.9 565.5 166.9C572.3 184.6 576 203.9 576 224C576 312.4 504.4 384 416 384C398.5 384 381.6 381.2 365.8 376L178.9 562.9C150.8 591 105.2 591 77.1 562.9C49 534.8 49 489.2 77.1 461.1L264 274.2C258.8 258.4 256 241.6 256 224C256 135.6 327.6 64 416 64C436.1 64 455.4 67.7 473.1 74.5C483.1 78.3 484.9 91 477.4 98.6L388.7 187.3C385.7 190.3 384 194.4 384 198.6L384 240C384 248.8 391.2 256 400 256L441.4 256C445.6 256 449.7 254.3 452.7 251.3L541.4 162.6z" />
      </svg>
    </div>
    <div className="prose min-w-0 w-full">{children}</div>
  </div>;

<Troubleshoot>
  <TroubleshootTitle>
    ### Login hangs on headless servers or SSH sessions
  </TroubleshootTitle>

  <TroubleshootCause>
    On versions of `anaconda-auth` older than 0.15.0, the default login flow attempts to open a web browser for OAuth authentication. If you are on a headless server, in an SSH session, or on any system without a graphical browser, this causes the login command to hang indefinitely.

    In `anaconda-auth` 0.15.0 and later, the device code flow is used by default, which does not require a local browser. If you are experiencing this issue, you are likely running an older version.
  </TroubleshootCause>

  <TroubleshootSolution>
    Update `anaconda-auth` to 0.15.0 or later, which uses the device code flow by default:

    ```sh theme={null}
    conda install "anaconda-auth>=0.15.0"
    ```

    If you cannot update, use one of the following workarounds:

    <AccordionGroup>
      <Accordion title="Enable device flow with an environment variable">
        Set the `ANACONDA_AUTH_USE_DEVICE_FLOW` environment variable before running the login command:

        ```sh theme={null}
        export ANACONDA_AUTH_USE_DEVICE_FLOW=1
        anaconda auth login
        ```

        The CLI prints a verification URL and a one-time code. Open the URL on any device with a browser, enter the code, and the login completes on the headless system.
      </Accordion>

      <Accordion title="Configure device flow permanently for a site">
        Use `anaconda sites modify` to enable device flow for the configured site:

        ```sh theme={null}
        anaconda sites modify --use-device-flow <SITE_NAME>
        ```

        After this, all future `anaconda auth login` calls for that site use device flow.
      </Accordion>

      <Accordion title="Use an API key environment variable">
        If you do not need interactive login (for example, in CI/CD pipelines or automated scripts), bypass the login flow entirely by setting an API key:

        ```sh theme={null}
        export ANACONDA_AUTH_API_KEY=$(anaconda auth api-key)
        ```

        On a system where you cannot run `anaconda auth api-key` directly, retrieve the key on another machine first and inject it through your platform's secrets management (for example, GitHub Actions secrets or a vault).
      </Accordion>
    </AccordionGroup>
  </TroubleshootSolution>
</Troubleshoot>

<Troubleshoot>
  <TroubleshootTitle>Unauthorized (401) error when uploading or managing packages</TroubleshootTitle>

  <TroubleshootCause>
    Your authentication token is missing, expired, or does not have the required scopes.
  </TroubleshootCause>

  <TroubleshootSolution>
    Run `anaconda login` to re-authenticate:

    ```sh theme={null}
    anaconda login
    ```

    When using a token, verify that the token has the required scopes by running `anaconda auth --info`:

    ```sh theme={null}
    anaconda auth --info
    ```

    To create a new token with the required scopes, see the [`anaconda auth`](/docs/cli-reference/anaconda-client/commands/auth) command reference.
  </TroubleshootSolution>
</Troubleshoot>

<Troubleshoot>
  <TroubleshootTitle>Package not found (404) error</TroubleshootTitle>

  <TroubleshootCause>
    The package spec is incorrect, the package does not exist, or you do not have permissions to access the package.
  </TroubleshootCause>

  <TroubleshootSolution>
    Verify the package spec format (`USER/PACKAGE/VERSION`) by running `anaconda org show` with your spec:

    ```sh theme={null}
    anaconda org show <SPEC>
    ```

    If the package is private, verify you are logged in with an account that has permissions to access the package.
  </TroubleshootSolution>
</Troubleshoot>

<Troubleshoot>
  <TroubleshootTitle>SSL certificate verification failed</TroubleshootTitle>

  <TroubleshootCause>
    Your system's SSL certificates are out of date, or you are behind a corporate proxy with a custom certificate authority.
  </TroubleshootCause>

  <TroubleshootSolution>
    Update your root certificates to the latest version, or disable SSL verification in your configuration:

    ```sh theme={null}
    anaconda org config --set ssl_verify false
    ```

    <Warning>
      Do not disable SSL verification in production. Doing so exposes your credentials to potential interception.
    </Warning>
  </TroubleshootSolution>
</Troubleshoot>

<Troubleshoot>
  <TroubleshootTitle>Upload fails with "file already exists"</TroubleshootTitle>

  <TroubleshootCause>
    A file with the same name and version already exists in the target label.
  </TroubleshootCause>

  <TroubleshootSolution>
    Use `--force` to overwrite the existing file, or `--skip-existing` to skip files that are already uploaded:

    <Tabs>
      <Tab title="Overwrite">
        ```sh theme={null}
        anaconda org upload mypackage.conda --force
        ```
      </Tab>

      <Tab title="Skip">
        ```sh theme={null}
        anaconda org upload *.conda --skip-existing
        ```
      </Tab>
    </Tabs>
  </TroubleshootSolution>
</Troubleshoot>
