Skip to Content
New to Genbox? Check out our Getting Started guide
Commandsvalidate

gb validate

Validate Genbox configuration files.

Synopsis

gb validate [options]

Description

Checks your configuration for errors, warnings, and potential issues before creating environments. Validates schema, $detect resolution, connections, and environment references.

Options

OptionDescription
--profile <name>Validate with specific profile
--strictTreat warnings as errors
--fixAttempt to fix simple issues

Examples

Basic Validation

gb validate

With Profile

gb validate --profile full-stack

Strict Mode

gb validate --strict

Validation Output

Successful Validation

Validating configuration... Schema validation: βœ“ Version 4.0 valid βœ“ Project structure valid βœ“ All required fields present $detect resolution: βœ“ apps.web.port β†’ 3000 βœ“ apps.web.framework β†’ nextjs βœ“ apps.api.port β†’ 3050 Connection validation: βœ“ web β†’ api (NEXT_PUBLIC_API_URL) βœ“ api β†’ mongodb (MONGODB_URI) βœ“ api β†’ redis (REDIS_URL) Environment references: βœ“ staging.mongodb.url resolved βœ“ staging.api.url resolved ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Result: βœ“ Configuration valid Ready to create environments!

Validation with Errors

Validating configuration... Schema validation: βœ“ Version 4.0 valid βœ— apps.admin.port: required field missing $detect resolution: βœ“ apps.web.port β†’ 3000 βœ— apps.admin.port: could not detect Tried: package.json scripts.dev (no --port flag found) Suggestions: β€’ Add explicit value: port: 3001 β€’ Add --port flag to scripts.dev in admin/package.json β€’ Check detected.yaml for available values Connection validation: βœ“ web β†’ api (NEXT_PUBLIC_API_URL) βœ— api β†’ elasticsearch: 'elasticsearch' not defined If api needs elasticsearch, add to provides: provides: elasticsearch: type: search image: elasticsearch:8 port: 9200 Environment references: ⚠ staging.mongodb.url contains ${STAGING_MONGODB_URL} STAGING_MONGODB_URL not found in .env.genbox This will fail at runtime unless the variable is set. ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Result: 2 errors, 1 warning Fix errors before running 'gb create'.

Validation Categories

Schema Validation

  • Required fields present
  • Valid field types
  • Valid enum values
  • Proper structure

$detect Resolution

  • All markers can be resolved
  • Detected values available
  • No circular references

Connection Validation

  • Referenced services exist
  • Connection modes valid
  • No orphaned connections

Environment References

  • Environment variables exist
  • URLs properly formatted
  • Source environments defined

Fix Mode

gb validate --fix

Attempts to fix simple issues:

  • Add missing optional fields with defaults
  • Correct common typos
  • Format YAML properly

Notes

  • Run before gb create to catch issues early
  • Use --strict in CI/CD pipelines
  • Errors must be fixed; warnings are informational
  • --fix only handles simple issues

See Also

Last updated on