CLI Troubleshooting
Solutions for common issues when using the Codeflash CLI.Common Issues
'Functions outside module-root' Error
'Functions outside module-root' Error
Problem: Function not found because file is outside
module-root.Solution: Ensure your file is within the module-root directory specified in pyproject.toml.'benchmarks-root must be specified' Error
'benchmarks-root must be specified' Error
Problem: Using
--benchmark without specifying benchmarks directory.Solution: Either add benchmarks-root to pyproject.toml or use the flag:Replay Test File Not Found
Replay Test File Not Found
Problem: Replay test filename doesnβt match expected path.Solution: Replay tests include the module path in their name. Check the actual filename:
Replay test files are named based on the traced script path. For
src/app.py,
the replay test will be named like test_srcapp_py__replay_test_0.py.GitHub App Required
GitHub App Required
Problem: PR creation fails due to missing GitHub App.Solution: Install the Codeflash GitHub App or use
--no-pr for local optimization:Module Not Found Errors
Module Not Found Errors
Problem: Codeflash canβt find your Python modules.Solution:
- Verify
module-rootis correctly set inpyproject.toml - Ensure youβre running from the project root
- Check that your Python environment has all dependencies installed
Test Generation Fails
Test Generation Fails
Problem: Codeflash canβt generate tests for your function.Solution:
- Ensure your function has a return statement
- Check that the function is not a property or class method with special decorators
- Use
--no-gen-teststo skip test generation and use existing tests only
Optimization Timeout
Optimization Timeout
Problem: Optimization takes too long or times out.Solution:
- Use
--verboseto see whatβs happening - For tracing, use
--timeoutto limit trace duration - For large functions, consider breaking them down
Getting Help
If youβre still experiencing issues:- Check the logs: Use
--verboseflag to see detailed output - Verify setup: Run
codeflash --verify-setupto check your installation - Check configuration: Ensure
pyproject.tomlis correctly configured - View help: Run
codeflash --helporcodeflash <command> --help