CircleCI-Public / CircleCI-Public/circleci-cli

`pytest` CI step fails due to go panic from `tests-plugin-cli`

Open
#1,153 2 comments 6 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
459
Forks
255
Avg merge
1d 4h
Merged PRs (30d)
59

Description

## Meta:

**CircleCI CLI Version:**

```
circleci@4ced5db8e415:~$ circleci version
Build Agent version: 1.0.287269-f2b94789
Built: 2025-07-31T16:47:08+0000
```

**CircleCI Tests Plugin CLI Version:**

```
Installing circleci-tests-plugin-cli plugin.
circleci-tests-plugin-cli plugin Installed. Version: 1.0.9952-dcfc394
```

**Operating System:**

```
circleci@4ced5db8e415:~$ uname -a
Linux 4ced5db8e415 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
```

**CircleCI CLI Diagnostic:**

```
circleci@4ced5db8e415:~$ sudo circleci diagnostic

---
CircleCI CLI Diagnostics
---
Debugger mode: false
Config found: /root/.circleci/cli.yml
API host: https://circleci.com
API endpoint: graphql-unstable
OK, got a token.
Hello, Violet Folino Gallo.
```

---

## Current behavior:

The failure occurs during a step which runs a pytest suite as shown below.
```
Pytest command passed to circleci test run:
xargs python -m pytest --junitxml=/tmp/test-results/pytest/results-0.xml -vv --capture=tee-sys --disable-warnings --durations=50 --durations-min=0.1 --conn=pipeliner/sql/tests/conn/postgres.conn --conn=pipeliner/sql/tests/conn/sqlite.conn --conn=pipeliner/sql/tests/conn/presto.conn --conn=pipeliner/sql/tests/conn/sql_server.conn --conn=pipeliner/sql/tests/conn/mysql.conn --conn=/tmp/bigquery.conn --conn=/tmp/snowflake.conn --conn=/tmp/databricks.conn --conn=/tmp/redshift_circleci.conn --maxfail=50 -o junit_family=xunit1 -o junit_logging=all --tb=short
```
Eventually the tests all complete and pass, so the job _should_ return a successful result.
```
= 711 passed, 19 skipped, 60 xfailed, 4 xpassed, 667 warnings in 135.80s (0:02:15) =
DEBU[2025-07-30T22:11:06Z] Completed tests
DEBU[2025-07-30T22:11:06Z] ending execution
```
Instead, a go panic occurs immediately afterwards and the step exits with a failure code.
```
panic: cant have gotCon after getCon

goroutine 1 [running]:
github.com/circleci/backplane-go/httpcl.(*request).gotCon(0xc000136150, {{0xd9b758?, 0xc000274e08?}, 0x80?, 0xf8?, 0x1345160?})
/home/circleci/go/pkg/mod/github.com/circleci/backplane-go@v0.43.18887/httpcl/metrics.go:320 +0x1250
net/http.http2traceGotConn(0xc00003c3c0?, 0xc000103340, 0x0)
/home/circleci/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.5.linux-amd64/src/net/http/h2_bundle.go:10916 +0x203
net/http.(*http2Transport).RoundTripOpt(0xc000122280, 0xc000124500, {0xc0?, 0xc3?})
/home/circleci/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.5.linux-amd64/src/net/http/h2_bundle.go:8062 +0x1d7
net/http.(*http2Transport).RoundTrip(...)
/home/circleci/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.5.linux-amd64/src/net/http/h2_bundle.go:8014
net/http.http2noDialH2RoundTripper.RoundTrip({0xc000132000?}, 0xc000124500?)
/home/circleci/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.5.linux-amd64/src/net/http/h2_bundle.go:10872 +0x1c
net/http.(*Transport).roundTrip(0xc000132000, 0xc0001243c0)
/home/circleci/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.5.linux-amd64/src/net/http/transport.go:615 +0x497
net/http.(*Transport).RoundTrip(0x470fd9?, 0x148?)
/home/circleci/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.5.linux-amd64/src/net/http/roundtrip.go:30 +0x13
github.com/circleci/backplane-go/httpcl.(*Metrics).RoundTrip(0xc000136000, 0xc0001243c0)
/home/circleci/go/pkg/mod/github.com/circleci/backplane-go@v0.43.18887/httpcl/metrics.go:71 +0x74
net/http.send(0xc0001243c0, {0xd90500, 0xc000136000}, {0xc000282801?, 0xc000138048?, 0x0?})
/home/circleci/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.5.linux-amd64/src/net/http/client.go:259 +0x5e2
net/http.(*Client).send(0xc0001202a0, 0xc0001243c0, {0x407d8e?, 0xc000466cc0?, 0x0?})
/home/circleci/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.5.linux-amd64/src/net/http/client.go:180 +0x91
net/http.(*Client).do(0xc0001202a0, 0xc0001243c0)
/home/circleci/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.5.linux-amd64/src/net/http/client.go:728 +0x989
net/http.(*Client).Do(...)
/home/circleci/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.5.linux-amd64/src/net/http/client.go:587
github.com/circleci/backplane-go/httpcl.(*Client).retryRequest.func1(0xc0001c2de0)
/home/circleci/go/pkg/mod/github.com/circleci/backplane-go@v0.43.18887/httpcl/httpclient.go:632 +0x752
github.com/circleci/backplane-go/httpcl.Retry({0xd96210, 0x1345160}, 0xc00071a060)
/home/circleci/go/pkg/mod/github.com/circleci/backplane-go@v0.43.18887/httpcl/retry.go:62 +0x16f
github.com/circleci/backplane-go/httpcl.(*Client).retryRequest(0xc000126270, {0xd96210, 0x1345160}, {0xc0000108c0, 0xb}, {{0xc65c86, 0x4}, {0xc6b8b7, 0x6}, {0xc1ade0, ...}, ...}, ...)
/home/circleci/go/pkg/mod/github.com/circleci/backplane-go@v0.43.18887/httpcl/httpclient.go:689 +0x29c
github.com/circleci/backplane-go/httpcl.(*Client).Call(0xc000126270, {0xd96210, 0x1345160}, {{0xc65c86, 0x4}, {0xc6b8b7, 0x6}, {0xc1ade0, 0xc0001be000}, {0x0, ...}, ...})
/home/circleci/go/pkg/mod/github.com/circleci/backplane-go@v0.43.18887/httpcl/httpclient.go:552 +0x4fe
github.com/circleci/tests-plugin-cli/internal/events.(*EventPublisher).sendEvent(0xc0001202d0, {0xd96210, 0x1345160}, {0xc753d5, 0xe}, {0xc6ee0b, 0x7}, 0xc0001888a0, {0xb97ca0, 0xc0001885d0})
/home/circleci/project/internal/events/publisher.go:93 +0x2aa
github.com/circleci/tests-plugin-cli/internal/events.SendEvent({0xd96210?, 0x1345160?}, 0x419705?, {0xc753d5?, 0x0?}, {0xc6ee0b?, 0xc000249ec0?}, 0xa6a38c?, {0xb97ca0, 0xc0001885d0})
/home/circleci/project/internal/events/publisher.go:108 +0x72
github.com/circleci/tests-plugin-cli/cmd.(*TestPluginCommand).Execute(0xc000077e60)
/home/circleci/project/cmd/root.go:71 +0x2a5
github.com/circleci/tests-plugin-cli/cmd.Execute()
/home/circleci/project/cmd/root.go:108 +0x65
main.main()
/home/circleci/project/main.go:14 +0xbb
Error: exit status 2

Exited with code exit status 1
```

## Expected behavior:

When the command passed to circleci succeeds, the CI step should succeed.

## When did this begin / Was this previously working?:

The failure is intermittent, but was first observed on 29 July and has happened multiple times since then.

## Additional Information:

Happy to answer any follow up questions for me.

Contributor guide

Open the contributing guide

Research direction

Start by reading internal/events/publisher.go around EventPublisher.sendEvent and cmd/root.go around TestPluginCommand.Execute, then reproduce the reported pytest run through the tests plugin. Done means a successful test command does not trigger the Go panic and the CI step exits successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.