Troubleshooting Guide¶
This guide helps you diagnose and resolve common issues with SecretZero. Issues are organized by category for easy navigation.
Quick Diagnostics¶
Before diving into specific issues, run these commands to gather diagnostic information:
# Check SecretZero version
secretzero --version
# Validate configuration
secretzero validate
# Test provider connectivity
secretzero test
# Check Python version
python --version
# List installed packages
pip list | grep -E "(secretzero|boto3|azure|hvac)"
Installation Issues¶
Command Not Found¶
Symptom:
Causes & Solutions:
1. Package Not Installed¶
2. Wrong Python/pip¶
# Check which Python/pip you're using
which python
which pip
# Use specific Python version
python3 -m pip install secretzero
python3 -m secretzero --version
3. Not in PATH¶
# Find installation location
pip show secretzero | grep Location
# Add to PATH (Linux/macOS)
export PATH="$HOME/.local/bin:$PATH"
# Or use full path
~/.local/bin/secretzero --version
4. Virtual Environment¶
# Activate virtual environment
source venv/bin/activate # Linux/macOS
venv\Scripts\activate # Windows
# Then install
pip install secretzero
Import Errors¶
Symptom:
Solution:
# Reinstall with force
pip install --force-reinstall secretzero
# Or install in development mode
git clone https://github.com/zloeber/SecretZero.git
cd SecretZero
pip install -e .
Dependency Conflicts¶
Symptom:
Solution:
# Create clean virtual environment
python -m venv clean-venv
source clean-venv/bin/activate
# Install SecretZero
pip install --upgrade pip
pip install secretzero[all]
Python Version Issues¶
Symptom:
Solution:
# Check Python version
python --version
# Use Python 3.9+
python3.11 -m pip install secretzero
python3.11 -m secretzero --version
Permission Errors¶
Symptom:
Solution:
# Install for current user only
pip install --user secretzero
# Or use virtual environment (recommended)
python -m venv venv
source venv/bin/activate
pip install secretzero
Configuration Errors¶
Invalid YAML Syntax¶
Symptom:
Solution:
# Use YAML linter
pip install yamllint
yamllint Secretfile.yml
# Common issues:
# - Incorrect indentation (use 2 spaces, not tabs)
# - Missing colons
# - Unquoted special characters
Example Fix:
# ❌ Incorrect (tabs, missing quotes)
secrets:
api_key:
value: my-key-with-:-colon
# ✅ Correct (spaces, quoted)
secrets:
api_key:
value: "my-key-with-:-colon"
Missing Required Fields¶
Symptom:
Solution:
Every secret must have at least one target:
secrets:
api_key:
template:
type: api_key
fields:
- name: value
generator:
type: random-string
length: 32
# ✅ Add target
targets:
- type: local-file
path: .env
format: dotenv
Variable Interpolation Failures¶
Symptom:
Solution:
# ❌ Variable not defined
secrets:
api_key:
targets:
- type: aws-secretsmanager
name: "/{{var.environment}}/api_key"
# ✅ Define variable with default
variables:
environment: "{{env.ENVIRONMENT or 'development'}}"
Invalid Generator Configuration¶
Symptom:
Solution:
# List valid generator types
secretzero secret-types
# Common typos:
# - random_pasword → random-password
# - random_str → random-string
# - stattic → static
Invalid Target Configuration¶
Symptom:
Solution:
# Check valid target types
secretzero secret-types
# Correct target type names:
# - aws-secretsmanager (not aws_secrets_manager)
# - aws-ssm-parameter (not aws_ssm_param)
# - local-file (not file)
Provider Connectivity Issues¶
AWS Authentication Failures¶
Symptom:
Diagnosis:
Solutions:
Option 1: Environment Variables¶
export AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
export AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
export AWS_DEFAULT_REGION=us-east-1
secretzero test
Option 2: AWS Profile¶
Option 3: AWS Configure¶
Option 4: IAM Role (EC2/ECS)¶
AWS Permission Denied¶
Symptom:
Solution:
Check IAM permissions:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"secretsmanager:CreateSecret",
"secretsmanager:UpdateSecret",
"secretsmanager:PutSecretValue",
"secretsmanager:DescribeSecret"
],
"Resource": "arn:aws:secretsmanager:*:*:secret:/myapp/*"
}
]
}
For SSM Parameter Store:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ssm:PutParameter",
"ssm:GetParameter",
"ssm:DescribeParameters"
],
"Resource": "arn:aws:ssm:*:*:parameter/myapp/*"
}
]
}
Azure Authentication Failures¶
Symptom:
Diagnosis:
Solutions:
Option 1: Azure CLI¶
Option 2: Environment Variables¶
export AZURE_CLIENT_ID=your-client-id
export AZURE_CLIENT_SECRET=your-client-secret
export AZURE_TENANT_ID=your-tenant-id
secretzero test
Option 3: Managed Identity (Azure VM/Container)¶
Vault Connection Failures¶
Symptom:
Diagnosis:
# Check Vault is running
curl http://localhost:8200/v1/sys/health
# Check Vault token
echo $VAULT_TOKEN
Solutions:
# Start Vault (development mode)
vault server -dev
# Set token
export VAULT_TOKEN=root
# Or use custom URL
export VAULT_ADDR=https://vault.example.com
export VAULT_TOKEN=your-token
secretzero test
Kubernetes Connection Failures¶
Symptom:
Diagnosis:
Solutions:
# Set kubeconfig
export KUBECONFIG=/path/to/kubeconfig
# Or specify in Secretfile
providers:
kubernetes:
kind: kubernetes
auth:
kind: ambient
config:
kubeconfig: /path/to/kubeconfig
context: production
GitHub Authentication Failures¶
Symptom:
Solution:
# Generate Personal Access Token
# GitHub → Settings → Developer settings → Personal access tokens
# Set token
export GITHUB_TOKEN=ghp_your_token
secretzero test
Required Scopes:
repo(for repository secrets)admin:org(for organization secrets)workflow(for Actions secrets)
GitLab Authentication Failures¶
Symptom:
Solution:
# Generate Personal Access Token
# GitLab → Preferences → Access Tokens
# Set token
export GITLAB_TOKEN=glpat-your-token
secretzero test
Required Scopes:
api(full API access)write_repository(for variables)
Secret Generation Issues¶
Generator Not Found¶
Symptom:
Solution:
Use a supported generator type:
# List available generators
secretzero secret-types
# Supported generators:
# - random-password
# - random-string
# - static
# - script
Script Generator Timeout¶
Symptom:
Solution:
Increase timeout:
Script Generator Permission Denied¶
Symptom:
Solution:
# Make script executable
chmod +x my-script.sh
# Or use interpreter explicitly
generator:
type: script
command: bash
args:
- my-script.sh
Random Password Too Short¶
Symptom:
Solution:
Static Generator Validation Failed¶
Symptom:
Solution:
# Option 1: Fix value to match pattern
generator:
type: static
value: myvalue # Only lowercase letters
# Option 2: Update pattern
generator:
type: static
value: my-value
validation: '^[a-z\-]+$' # Allow hyphens
Environment Variable Override Not Working¶
Symptom:
Secret still being generated even though environment variable is set.
Diagnosis:
# Check exact variable name format
# Format: {SECRET_NAME}_{FIELD_NAME} in UPPERCASE
# Example for secret "api_key" with field "value":
export API_KEY_VALUE="my-custom-value"
Solution:
# Correct format
export API_KEY_VALUE="my-value"
secretzero sync
# For template secrets
export DATABASE_CREDENTIALS_PASSWORD="my-password"
secretzero sync
Target Storage Issues¶
File Already Exists¶
Symptom:
Solution:
targets:
- type: local-file
path: .env
format: dotenv
merge: true # ✅ Append/update instead of overwrite
File Permission Denied¶
Symptom:
Solution:
# Check file permissions
ls -la .env
# Make writable
chmod u+w .env
# Or delete and regenerate
rm .env
secretzero sync
Directory Not Found¶
Symptom:
Solution:
SecretZero automatically creates parent directories. If this fails:
AWS Secret Already Exists¶
Symptom:
Solution:
targets:
- type: aws-secretsmanager
name: /myapp/api_key
# Option 1: Allow updates (recommended)
update_existing: true
# Option 2: Use different name
# name: /myapp/api_key_v2
Kubernetes Secret Not Found¶
Symptom:
Solution:
# Create namespace first
kubectl create namespace production
# Or use existing namespace
kubectl get namespaces
Lockfile Issues¶
Lockfile Corrupted¶
Symptom:
Solution:
# Backup existing lockfile
cp .gitsecrets.lock .gitsecrets.lock.backup
# Delete and regenerate
rm .gitsecrets.lock
secretzero sync
Hash Mismatch¶
Symptom:
Diagnosis:
Solution:
# Option 1: Resync to update lockfile
secretzero sync
# Option 2: Force regenerate
secretzero sync --force
Lockfile Git Conflicts¶
Symptom:
<<<<<<< HEAD
"api_key": {
"hash": "sha256:abc123..."
=======
"api_key": {
"hash": "sha256:def456..."
>>>>>>> branch
Solution:
# Keep one version (usually newer)
git checkout --theirs .gitsecrets.lock
# Then resync to update
secretzero sync
Rotation Issues¶
Rotation Not Due Yet¶
Symptom:
Solution:
# Check rotation status
secretzero rotate --dry-run
# Force rotation if needed
secretzero rotate --force api_key
One-Time Secret Can't Rotate¶
Symptom:
Explanation:
This is expected behavior. One-time secrets are not rotated automatically.
Solution:
# To rotate anyway, remove from lockfile
secretzero sync --force master_key
# Or remove one_time flag
Rotation Period Invalid¶
Symptom:
Solution:
Use correct format:
# ❌ Invalid formats
rotation:
period: "3 months"
period: "90 days"
# ✅ Valid formats
rotation:
period: 90d # Days
period: 12w # Weeks
period: 3m # Months
period: 1y # Years
Policy Issues¶
Policy Validation Failures¶
Symptom:
Solution:
Add rotation period:
SOC2 Compliance Failures¶
Symptom:
Solution:
Access Policy Denials¶
Symptom:
Solution:
# Option 1: Remove denied target
targets:
- type: aws-secretsmanager # ✅ Allowed
# Option 2: Update policy
policies:
cloud_only:
type: access
config:
allowed_targets:
- aws-secretsmanager
- local-file # ✅ Add to allowed list
API Service Issues¶
API Server Won't Start¶
Symptom:
Solution:
# Check what's using port 8000
lsof -i :8000
# Use different port
export SECRETZERO_PORT=9000
secretzero-api
API Authentication Failed¶
Symptom:
Solution:
# Set API key
export SECRETZERO_API_KEY="your-api-key"
# Include in request
curl -H "X-API-Key: $SECRETZERO_API_KEY" \
http://localhost:8000/secrets
API Returns 404¶
Symptom:
Solution:
Endpoints don't have /api prefix:
CI/CD Issues¶
GitHub Actions: Command Not Found¶
Symptom:
Solution:
Install SecretZero first:
steps:
- name: Install SecretZero
run: pip install secretzero[aws]
- name: Sync Secrets
run: secretzero sync
GitLab CI: Authentication Failed¶
Symptom:
Solution:
Add credentials as CI/CD variables:
sync-secrets:
script:
- pip install secretzero[aws]
- secretzero sync
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
Jenkins: Pipeline Fails¶
Symptom:
Solution:
pipeline {
agent any
stages {
stage('Sync Secrets') {
steps {
sh '''
python3 -m pip install secretzero[all]
python3 -m secretzero sync
'''
}
}
}
}
Performance Issues¶
Slow Secret Generation¶
Symptom:
Sync takes a long time to complete.
Diagnosis:
Solutions:
- Script Generators: Check script execution time
- Cloud Targets: Check network latency
- Many Secrets: Consider batching
High Memory Usage¶
Symptom:
SecretZero using excessive memory.
Solutions:
- Reduce number of secrets per sync
- Split into multiple Secretfiles
- Use
--forceonly when necessary
Getting More Help¶
Enable Debug Logging¶
Collect Diagnostic Information¶
# System info
cat > diagnostic.txt << EOF
SecretZero Version: $(secretzero --version)
Python Version: $(python --version)
OS: $(uname -a)
Installed Packages: $(pip list | grep -E "(secretzero|boto3|azure|hvac)")
EOF
# Attach to issue
Report a Bug¶
If none of these solutions work, please open an issue with:
- SecretZero version
- Python version
- Operating system
- Full error message
- Steps to reproduce
- Redacted configuration (remove sensitive data)
Additional Resources¶
- FAQ - Common questions
- Architecture - Technical details
- GitHub Discussions - Community support
- Examples - Working configurations