Troubleshooting
This guide covers common issues you may encounter when using cuenv and how to resolve them.
Installation Issues
Section titled “Installation Issues”Command Not Found
Section titled “Command Not Found”If cuenv is not recognized after installation:
# Ensure cargo bin is in PATHecho 'export PATH="$HOME/.cargo/bin:$PATH"' >> ~/.bashrcsource ~/.bashrc
# Verify installationwhich cuenvcuenv versionBuild Failures from Source
Section titled “Build Failures from Source”Missing Rust toolchain:
# Install or update Rustcurl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shrustup updateMissing Go (required for CUE engine):
The cuengine crate requires Go for the CUE evaluation bridge. Ensure Go 1.21+ is installed:
# Check Go versiongo version
# Install via your package manager or https://go.dev/dl/OpenSSL/TLS errors:
# Ubuntu/Debiansudo apt install pkg-config libssl-dev
# Fedora/RHELsudo dnf install openssl-devel
# macOSbrew install opensslCUE Evaluation Errors
Section titled “CUE Evaluation Errors”Syntax Errors
Section titled “Syntax Errors”CUE syntax errors will show the file and line number:
error: CUE evaluation failed --> env.cue:5:10 | 5 | PORT: 8080 | ^^^^ expected string, found intCommon fixes:
- Environment variables must be strings: use
PORT: "8080"notPORT: 8080 - Check for missing commas between fields
- Ensure proper brace matching
Constraint Violations
Section titled “Constraint Violations”When values don’t match constraints:
error: constraint violation NODE_ENV: "invalid" does not satisfy "development" | "staging" | "production"Fix: Ensure your values match the defined constraints in your schema.
Import Errors
Section titled “Import Errors”error: cannot find package "github.com/myorg/schemas"Fixes:
-
Ensure the CUE module is properly initialized:
Terminal window cue mod init github.com/myorg/myproject -
Check that imported packages exist in
cue.mod/ -
For external dependencies, ensure they’re fetched:
Terminal window cue get go github.com/myorg/schemas
Circular References
Section titled “Circular References”error: circular reference detected a -> b -> aCUE does not allow circular references. Restructure your configuration to eliminate cycles.
Shell Integration Issues
Section titled “Shell Integration Issues”Hooks Not Triggering
Section titled “Hooks Not Triggering”If environment hooks don’t run when entering a directory:
-
Verify shell integration is loaded:
Terminal window # Check if cuenv functions existtype _cuenv_hook 2>/dev/null || echo "Shell integration not loaded" -
Re-source your shell config:
Terminal window # Bashsource ~/.bashrc# Zshsource ~/.zshrc# Fishsource ~/.config/fish/config.fish -
Regenerate shell integration:
Terminal window # Remove old integration and regeneratecuenv shell init bash >> ~/.bashrc
Configuration Not Approved
Section titled “Configuration Not Approved”cuenv requires explicit approval before executing hooks for security:
error: configuration not approved Run 'cuenv allow' to approve this configurationFix:
# Review the configuration firstcat env.cue
# Approve if it looks safecuenv allow
# Or approve with a notecuenv allow --note "Reviewed on 2025-01-15"Environment Variables Not Loading
Section titled “Environment Variables Not Loading”-
Check if env.cue exists and is valid:
Terminal window cuenv env print -
Verify the package name:
Terminal window # Default package is 'cuenv'cuenv env print --package cuenv -
Check for evaluation errors:
Terminal window cuenv env check
Task Execution Issues
Section titled “Task Execution Issues”Task Not Found
Section titled “Task Not Found”error: task 'build' not foundFixes:
-
List available tasks:
Terminal window cuenv task -
Check task is defined in
env.cue:tasks: {build: {command: "bun"args: ["run", "build"]}} -
Verify correct working directory:
Terminal window pwdls env.cue
Task Dependency Failures
Section titled “Task Dependency Failures”When a task fails due to dependency:
error: task 'build' failed: dependency 'test' exited with code 1Fix: Run the failing dependency directly to see full output:
cuenv task testCommand Not Found in Task
Section titled “Command Not Found in Task”error: task 'lint' failed: command 'eslint' not foundThe command must be available in your PATH. Options:
- Install the missing tool globally
- Use Nix integration to provision tools (when available)
- Use full path to the command:
tasks: {lint: {command: "bunx"args: ["eslint", "."]}}
Performance Issues
Section titled “Performance Issues”Slow CUE Evaluation
Section titled “Slow CUE Evaluation”Large CUE configurations can be slow to evaluate. Tips:
-
Leverage the built-in task cache by declaring accurate
inputsandoutputsfor every task. Caching is automatic once those fields exist, and you can inspect the cache key for a task with:Terminal window cuenv task build --show-cache-path -
Split large configurations into smaller, focused files
-
Avoid complex computed values where possible
High Memory Usage
Section titled “High Memory Usage”If cuenv uses excessive memory:
- Check for recursive or deeply nested structures
- Simplify constraint expressions
- Report the issue with a minimal reproduction case
Debug Mode
Section titled “Debug Mode”Enable verbose logging for debugging:
# Set log levelcuenv --level debug task build
# Or trace for maximum detailcuenv --level trace env printGetting Help
Section titled “Getting Help”If you can’t resolve an issue:
-
Search existing issues: GitHub Issues
-
Create a new issue with:
- cuenv version (
cuenv version) - Operating system and version
- Complete error message
- Minimal
env.cueto reproduce
- cuenv version (
-
Join the discussion: GitHub Discussions