Skip to Content

Error codes

Every failure the Gofasta CLI reports carries a stable, machine-readable code. Codes exist so that scripts, CI steps, and AI coding agents can branch on what went wrong without pattern-matching English error text that may be reworded later.

Where codes appear

In text mode the code is printed alongside the message and a remediation hint. Under --json, stdout carries the error object:

{ "code": "DEV_PORT_IN_USE", "message": "port 8080 is already in use", "hint": "another process is already bound to the configured PORT; stop it, pick a different port with `--port`, or update `server.port` in config.yaml", "docs": "https://gofasta.dev/docs/cli-reference/dev" }

hint and docs are looked up from the code registry, so the same code always produces the same remediation guidance regardless of which command raised it. Both fields are omitted when empty.

Stability guarantee

A code is part of the CLI’s public interface. Once shipped it is never renamed — a code that stops being useful is deprecated in favor of a successor rather than repurposed. Automation can safely hard-code the strings below.

Unregistered codes still produce usable errors, just without a hint or docs link. INTERNAL is reserved for unexpected failures that indicate a bug in the CLI itself rather than anything wrong with your project — those are worth reporting.

The codes

General

CodeWhat it means and how to recoverReference
INTERNALfile a bug at https://github.com/gofastadev/cli/issues  with the full command output—

Project lifecycle

CodeWhat it means and how to recoverReference
NOT_GOFASTA_PROJECTrun this command from the root of a gofasta project (directory containing go.mod plus the scaffolded app/ directory)docs
PROJECT_DIR_EXISTSchoose a different project name or remove the existing directorydocs
INVALID_NAMEproject names must be a valid Go module path (lowercase letters, digits, dots, slashes, hyphens)docs

go / go.mod

CodeWhat it means and how to recoverReference
GO_MOD_INIT_FAILEDmake sure Go 1.25.0 or later is installed and on $PATH; run go version to checkdocs
GO_MOD_TIDY_FAILEDrun go mod tidy manually and inspect the output; a transitive dep may be unavailable or the module proxy may be unreachabledocs
GOFASTA_INSTALL_FAILEDwait 5–30 minutes for sum.golang.org to index a freshly-published release and re-run gofasta new; the CLI installs the exact gofasta library version it was tested against, so no manual go get is neededdocs
GO_BUILD_FAILEDthe generated or edited Go code does not compile; fix the error above and re-run—
GO_TEST_FAILEDone or more tests failed; inspect the output above for the specific failuredocs
GO_VET_FAILEDgo vet flagged a static issue; address the warnings above and re-run—
GO_FMT_FAILEDrun gofmt -s -w . to apply formatting—
GO_LINT_FAILEDgolangci-lint reported issues; run golangci-lint run for full output—

Wire / codegen

CodeWhat it means and how to recoverReference
WIRE_MISSING_PROVIDERadd the provider to a provider set in app/di/providers/, then run gofasta wire to regeneratedocs
WIRE_GENERATION_FAILEDWire failed to generate — inspect the error above; common causes are a missing provider, a type mismatch, or a circular dependencydocs
GENERATOR_FAILEDthe generator could not complete; inspect the error above and verify the project layout is intactdocs
PATCHER_FAILEDthe patcher could not locate an expected marker in a target file; verify you have not heavily modified the generated scaffold filesdocs
SWAGGER_GENERATION_FAILEDrun gofasta swagger manually to inspect the error; usually caused by malformed Swagger annotations on controller methodsdocs
GQLGEN_GENERATION_FAILEDrun go tool gqlgen generate manually to inspect the error; usually caused by a malformed .gql schema filedocs

Database / migrations

CodeWhat it means and how to recoverReference
MIGRATION_FAILEDinspect the SQL error above; ensure the database is reachable and the migration file is validdocs
MIGRATION_DIR_MISSINGcreate db/migrations/ or generate a migration with gofasta g migrationdocs
SEED_FAILEDa seeder returned an error; inspect the output abovedocs
DATABASE_UNREACHABLEverify the database is running and the database section of config.yaml matches; test with gofasta doctordocs
DATABASE_RESET_FAILEDgofasta db reset could not complete; inspect the step that failed abovedocs

Deploy

CodeWhat it means and how to recoverReference
DEPLOY_HOST_REQUIREDset deploy.host in config.yaml or pass —host user@serverdocs
DEPLOY_CONFIG_INVALIDthe deploy configuration is invalid; run gofasta doctor or check config.yaml against the schemadocs
SSH_FAILEDverify your SSH key is authorized on the server and the host/port are reachable — test with ssh -p <port> user@server echo okdocs
HEALTH_CHECK_FAILEDthe deployed app did not respond at the health endpoint within the timeout; gofasta automatically rolled back to the previous release (first deploys are left in place) — inspect logs with gofasta deploy logsdocs
DOCKER_COMMAND_FAILEDa Docker command failed; check that Docker is running locally and on the remote host (run gofasta deploy setup to install it remotely)docs
ROLLBACK_FAILEDrollback could not complete; inspect the step that failed above — the current release is unchangeddocs

Introspection / utility

CodeWhat it means and how to recoverReference
ROUTES_DIR_MISSINGapp/rest/routes/ was not found — run this command from the root of a gofasta projectdocs
CONFIG_INVALIDconfig.yaml is malformed; validate it against the schema emitted by gofasta config schemadocs
CONFIG_NOT_FOUNDconfig.yaml not found in the current directorydocs
FILE_IOcould not read or write a file; check filesystem permissions—

Verify / preflight

CodeWhat it means and how to recoverReference
VERIFY_FAILEDgofasta verify reported a failing check above; fix the first failure and re-run—

AI installer

CodeWhat it means and how to recoverReference
UNKNOWN_AGENTrun gofasta ai list to see supported agents—
AI_MANIFEST_IOcould not read or write .gofasta/ai.json; check filesystem permissions—
AI_INSTALL_FAILEDone or more agent configuration files could not be written; inspect the error above—
AI_AGENT_CONFLICTanother AI agent is already installed in this project; re-run with --switch to replace it, or gofasta ai uninstall <agent> to remove it first—

Debug (gofasta debug)

CodeWhat it means and how to recoverReference
DEBUG_APP_UNREACHABLEthe target app is not reachable at the resolved URL — start it with gofasta dev or pass --app-url=http://host:port if it runs on a different addressdocs
DEBUG_DEVTOOLS_OFFthe app is running without the devtools build tag — rebuild under gofasta dev (which sets GOFLAGS=-tags=devtools) so /debug/* endpoints become availabledocs
DEBUG_TRACE_NOT_FOUNDthe requested trace is not in the ring — it may have been evicted (rings hold at most 50 traces); re-issue the request you want to inspect and try againdocs
DEBUG_BAD_FILTERa filter value was rejected; see the command’s —help for accepted syntaxdocs
DEBUG_BAD_DURATIONduration values use Go’s time.ParseDuration syntax — e.g. 100ms, 2s, 1m30sdocs
DEBUG_PROFILE_UNSUPPORTEDsupported profile kinds: cpu, heap, goroutine, mutex, block, allocs, threadcreate, tracedocs
DEBUG_EXPLAIN_FAILEDEXPLAIN is SELECT-only and requires the app to have registered its *gorm.DB via devtools.RegisterDB — verify the app was built with the devtools tagdocs

Dev server (gofasta dev)

CodeWhat it means and how to recoverReference
DEV_DOCKER_UNAVAILABLEinstall Docker Desktop (or Docker Engine + docker compose plugin) and make sure the daemon is running — test with docker infodocs
DEV_COMPOSE_NOT_FOUNDa compose.yaml is required for service orchestration; re-run with --no-services to skip Docker and run Air against an externally-managed databasedocs
DEV_SERVICE_UNHEALTHYa compose service did not become healthy within the timeout; tail its logs with docker compose logs <service>, or raise --wait-timeoutdocs
DEV_MIGRATION_FAILEDmigrate up returned a non-zero exit; inspect the SQL error above or re-run with --no-migrate to skip and investigate the DB state manuallydocs
DEV_AIR_NOT_INSTALLEDAir is not registered on the project toolchain; run go get github.com/air-verse/air@latest && go mod edit -tool github.com/air-verse/airdocs
DEV_PORT_IN_USEanother process is already bound to the configured PORT; stop it, pick a different port with --port, or update server.port in config.yamldocs
DEV_FLAG_CONFLICTtwo flags requested incompatible behavior — see the message above; run gofasta dev --help for the flag matrixdocs
DEV_LOCAL_REPLACEfilesystem-path replaces (e.g. replace ... => ../foo) only resolve on the host — the docker build context cannot see paths outside the project. Either run without —all-in-docker (host mode handles local replaces fine), drop the replace and go get a published version, or vendor with go mod vendor so the replaced module is bundled into the build context.docs
DEV_SERVICE_UNKNOWNthe name passed to —services is not declared in compose.yaml; check docker compose config --services for the list of valid namesdocs
DEV_PREFLIGHT_CANCELEDpreflight was canceled by the user (menu option [4]) or aborted on a non-TTY session — resolve the unreachable dependency manually, then re-run gofasta devdocs

Upgrade (gofasta upgrade)

CodeWhat it means and how to recoverReference
UPGRADE_VERIFICATION_FAILEDcould not verify the downloaded binary against the release checksums.txt — retry, or download and verify the release asset manually before installingdocs
INTERACTIVE_ONLYthis command requires an interactive terminal and cannot run in —json / headless mode; drop —json or invoke a non-interactive equivalentdocs

Cross-resource impact analysis (gofasta xrefs / impact)

CodeWhat it means and how to recoverReference
SYMBOL_NOT_FOUNDthe symbol was not found in the current module — check the spelling and package qualifier (e.g. pkg.Func or pkg.Type.Method)docs
TYPE_ANALYSIS_FAILEDgo/packages could not type-check the module; run go build ./... to surface the underlying compile errordocs
PACKAGE_LOAD_FAILEDone or more packages failed to load — fix the build error above before running impact analysisdocs
AMBIGUOUS_SYMBOLthe unqualified symbol matches definitions in multiple packages; pass the fully qualified name (e.g. irodata/app/services.OrderService.Archive)docs

Change-scoped verify (—since / —changed)

CodeWhat it means and how to recoverReference
GIT_NOT_AVAILABLEthis directory is not a git repository — run git init or drop the —since/—changed flagdocs
GIT_DIFF_FAILEDgit diff returned an error; check that the ref exists locally (git fetch may be needed) and that you have read access to the repodocs
GIT_REF_NOT_FOUNDthe supplied git ref does not resolve — try git fetch origin or pass a known commit / branch / tagdocs

Modify-aware generators (g method / g field / g endpoint / …)

CodeWhat it means and how to recoverReference
RESOURCE_NOT_FOUNDno files match the given resource name — check spelling (PascalCase, singular) or run gofasta g scaffold <Name> to create it firstdocs
METHOD_ALREADY_EXISTSa method with that name already exists on the target interface — pick a different name or skip this generatordocs
FIELD_ALREADY_EXISTSthe model already has a field with that name — pick a different name or remove the existing field firstdocs
ROUTE_ALREADY_EXISTSthat METHOD + path combination is already registered — pick a different path or use gofasta g middleware to attach behaviordocs
AST_PARSE_FAILEDthe target Go file has a syntax error and cannot be parsed — fix the error above and re-rundocs
AST_PATCH_FAILEDcould not locate the AST insertion target (e.g. interface or struct named for the resource) — the file may have been heavily restructured; inspect manuallydocs

Migration safety preview (gofasta migrate up —explain)

CodeWhat it means and how to recoverReference
MIGRATION_LINT_FAILEDstatic SQL analysis errored on a pending migration — inspect the file for malformed SQL or unsupported syntaxdocs
MIGRATION_PARSE_FAILEDcould not split the migration into statements — check for unmatched $$ dollar-quote blocks or stray string literalsdocs

Mock regeneration (gofasta g mock)

CodeWhat it means and how to recoverReference
INTERFACE_NOT_FOUNDno interface with that name was found under app/services/interfaces/ or app/repositories/interfaces/ — check spelling or pass —all to refresh every mockdocs
MOCK_GEN_FAILEDthe mock template failed to render — inspect the error above; often caused by an interface that uses unsupported features (generics, embedded external interfaces)docs
MOCK_DRIFTthe on-disk mock no longer matches the interface — run gofasta g mock --all to regenerate, then commit the resultdocs

Job / task introspection (gofasta inspect-jobs / inspect-tasks)

CodeWhat it means and how to recoverReference
JOBS_DIR_MISSINGapp/jobs/ was not found — generate a job with gofasta g job <name> "<cron>" first, or run this command from the project rootdocs
TASKS_DIR_MISSINGapp/tasks/ was not found — generate a task with gofasta g task <name> first, or run this command from the project rootdocs

Debug replay (gofasta debug replay)

CodeWhat it means and how to recoverReference
DEBUG_REPLAY_NOT_FOUNDthe request id is not in the capture ring — it may have been evicted (rings hold at most 200 requests); re-issue the request you want to replaydocs
DEBUG_REPLAY_FAILEDthe replayed request failed at the target app — inspect the response payload above or check the app logsdocs
DEBUG_REPLAY_UNSAFEthe replay override was rejected by the SSRF guard — overrides may change path / headers / body but cannot change scheme, host, or portdocs

Debug stack resolver (gofasta debug stack)

CodeWhat it means and how to recoverReference
DEBUG_STACK_PARSE_FAILEDthe stack frame does not match the expected file:line function format — verify the source is a gofasta-captured stack (TraceSpan.Stack or ExceptionEntry.Stack)docs
DEBUG_SOURCE_UNAVAILABLEthe source file referenced in the stack frame is not present on disk (deleted, vendored, or outside the current module) — the frame is still resolvable but without source contextdocs

Refactor (gofasta refactor feature-package)

CodeWhat it means and how to recoverReference
REFACTOR_INELIGIBLEnot in a gofasta project, or already in the target layout — run gofasta refactor status to see where you actually aredocs
REFACTOR_ABORTEDthe migration started but the post-move go build failed — git restore . to revert, then investigate; the output shows which files moved before the failuredocs
REFACTOR_DIRTY_TREEthe git working tree has uncommitted changes — commit, stash, or pass --forcedocs
REFACTOR_RESOURCE_NOT_FOUNDthe named resource doesn’t have a file at the expected source path — spell the resource name correctly (PascalCase), or use --alldocs
REFACTOR_PRECHECK_FAILEDthe eligibility preflight found blocking conditions (torn per-resource state, unparseable files the migration must transform, a non-scaffold-shaped gqlgen.yml) — nothing was changed; fix the listed findings and re-run. gofasta refactor status re-checks eligibility. Not overridabledocs
REFACTOR_NO_GITthe project is not a git repository, so an aborted migration cannot be reverted — git init && git add -A && git commit first, or pass --force to accept the riskdocs
Last updated on