CumulusCI 4 refresh token error
Describe the bug
Since upgrading to CummulusCI 4, all commands that work with orgs are outputting the following error:
Exception ignored in: <_io.TextIOWrapper encoding='utf-8'> Traceback (most recent call last): File "/Users/kai.amundsen/.local/pipx/venvs/cumulusci/lib/python3.13/site-packages/cumulusci/core/config/sfdx_org_config.py", line 212, in refresh_oauth_token self.sfdx_info AttributeError: 'Capture' object has no attribute 'flush'
Reproduction steps
- Upgrade to CumulusCI 4.0.1 and sf cli 2.67.7
- run
cci org browser --org <existing org alias>
Org will open in browser successfully but an exception will be output one or many times to the command line.
Your CumulusCI and Python versions
CumulusCI version: 4.0.1 (/Users/kai.amundsen/.local/bin/cci) Python version: 3.13.0 (/Users/kai.amundsen/.local/pipx/venvs/cumulusci/bin/python) @salesforce/cli/2.67.7 darwin-arm64 node-v22.11.0
Operating System
MacOS 15.1.1 (24B91)
Windows environment
No response
CumulusCI installation method
pipx
Error Gist
No response
Additional information
No response
I am getting exactly the same issue, and I noticed that it also happens when running the cci org default command.
@yippie Thanks for reporting this. Python 3.13 made a change that now logs errors in file handling that were previously ignored. It’s related to how sarge (a library we use) interacts with io.TextIOWrapper.
This error doesn’t affect functionality. You can safely ignore it for now while we wait for an update from the sarge maintainers. If you prefer, you can downgrade to Python 3.12 to stop seeing the error.
@jstvz, thanks for clarifying! That’s great to know. I actually encountered an issue during my routine because the default org was set to an empty string (""). It seems like there might be an sf unset org somewhere. Thankfully, I was able to resolve it on my end.
I finally got enough annoyed by this issue to dig into it a bit. The maintainer of sarge responded to @jstvz's issue report here https://github.com/vsajip/sarge/issues/58 by submitting https://github.com/vsajip/sarge/commit/86c72316c457536d1da50831db564970e846585d to the master branch. An additional commit was also added here https://github.com/vsajip/sarge/commit/5a5ec7c0a3ad003a64649953da7ff8bff2fcf023 but then it appears no new version tag was created despite the package.json getting a version update to 0.1.8.dev0 in https://github.com/vsajip/sarge/commit/428e4f2d887ef38af843d51f1ec12f3ad734c599 and the same version number appearing in the documentation https://sarge.readthedocs.io/en/latest/.
I was able to get the error to go away after hot-patching my CumulusCI venv sarge package at /Users/gabrielrholl/.local/pipx/venvs/cumulusci/lib/python3.13/site-packages/sarge/__init__.py to add the fix from https://github.com/vsajip/sarge/commit/86c72316c457536d1da50831db564970e846585d after the def readlines(self, sizehint=-1, block=True, timeout=None): method:
def flush(self):
# This is sometimes called when you pass an instance to a TextIOWrapper
pass
Not sure if this is the right approach to hot-patching, but I figure it probably won't get overridden until 0.1.8.dev0 actually gets packaged up which it makes it better than the alternative I considered: Changing https://github.com/SFDO-Tooling/CumulusCI/blob/main/pyproject.toml line 52 to something like...
"sarge @ git+https://github.com/vsajip/sarge@5a5ec7c",
...but I haven't tested that and I don't think I'd even want to submit that as a pull request myself.
I finally got enough annoyed by this issue to dig into it a bit. The maintainer of sarge responded to @jstvz's issue report here vsajip/sarge#58 by submitting vsajip/sarge@86c7231 to the master branch. An additional commit was also added here vsajip/sarge@5a5ec7c but then it appears no new version tag was created despite the package.json getting a version update to
0.1.8.dev0in vsajip/sarge@428e4f2 and the same version number appearing in the documentation https://sarge.readthedocs.io/en/latest/.I was able to get the error to go away after hot-patching my CumulusCI venv sarge package at
/Users/gabrielrholl/.local/pipx/venvs/cumulusci/lib/python3.13/site-packages/sarge/__init__.pyto add the fix from vsajip/sarge@86c7231 after thedef readlines(self, sizehint=-1, block=True, timeout=None):method:def flush(self): # This is sometimes called when you pass an instance to a TextIOWrapper passNot sure if this is the right approach to hot-patching, but I figure it probably won't get overridden until
0.1.8.dev0actually gets packaged up which it makes it better than the alternative I considered: Changing https://github.com/SFDO-Tooling/CumulusCI/blob/main/pyproject.toml line 52 to something like..."sarge @ git+https://github.com/vsajip/sarge@5a5ec7c",...but I haven't tested that and I don't think I'd even want to submit that as a pull request myself.
This worked for me, thank you!