Initial run fails with 'Unathorized' but a a rerun form the CircleCi GUI will run successfully

I’ve added a shared context to our CircleCI account, added that to a specific build workflow, checked that it is NOT restricted and that it was done using a github user with full org admin access. However, when the pipeline is triggered by a git push, the initial run fails with an ''Unauthorized" message. If I hop into the CircleCI UI and initiate a manual “Rerun workflow from start”, the pipeline will run successfully.

We are using the CircleCI Slack orb, which was the original reason a Context was added (for Slack credentials).

As I mentioned, the context is open to “All members”, the integrating Github user is an org admin for the repo/org in github, and I can’t find any other restrictions that would be causing the issue. Any help would be appreciated! For what it is worth, once I manually ‘rerun from start’ the pipeline executes correctly and the context variables are being picked up with no issue.

The config I’m currently testing is:

    version: 2.1
slack: circleci/slack@4.3.0
    - image:
    description: Setup and run application tests
    working_directory: ~/build
    - checkout
    - restore_cache:
            - dotnet-packages-v1-{{ checksum "projname/someprojname.csproj" }}
    - run: 
        name: "Install .net core dependencies"
        command: | 
            apt-get update 
            apt-get install apt-transport-https -y
            apt-get install systemd -y
    - run: 
        name: "Install Nginx"
        command: |
            apt update
            apt install nginx -y
            service nginx start
    - run: 
        name: "Check status of Nginx"
        command: service nginx status 
    - run:
        name: "Install project dependencies"
        command: dotnet restore
    - run: 
        name: "Forcing a failure for debug"
        command: service doesnotexist status 
    - slack/notify:
        branch_pattern: cicd-setup,develop,master
        event: fail
        template: basic_fail_1
    - save_cache:
            - /build
        key: dotnet-packages-v1-{{ checksum "projname/someprojname.csproj" }}
    - run:
        name: "Run Application Tests"
        command: dotnet test -v n --results-directory:test_coverage --collect:"Code Coverage"
    - persist_to_workspace:
        root: ~/ 
            - "build" 
    - test:
        context: SLACK

Hi @davidcaughill,

Welcome to the CircleCI community forum!

Could you please provide me the GitHub ID of the users who are pushing & re-running the build?

Also, share the links to failed & successful jobs. If you are not comfortable sharing the links here, please open a Support ticket and let me know the case number.

Pawan Bahuguna

Hi Pawan,

Thank you for the response. I’ve logged a ticket with build links/details under: #86425

Thank you!

Hi David,

Thanks for opening the ticket. As I’m working on your ticket. I will close this Discuss thread.

Pawan Bahuguna