hasura/graphql-engine · error
setting up codegen-assets repo failed (this is required for
Error message
setting up codegen-assets repo failed (this is required for automatically generating actions code): %w
What it means
Thrown from the PreRunE hook of `hasura actions use-codegen` when ec.SetupCodegenAssetsRepo() fails. Setup ensures the codegen-assets repository is cloned and up to date locally so framework templates and starter kits can be listed; any git/network/filesystem failure inside setup surfaces here.
Source
Thrown at cli/commands/actions_use_codegen.go:51
hasura actions use-codegen --framework nodejs-express
# Use codegen from framework list
hasura actions use-codegen
# Set output directory
hasura actions use-codegen --output-dir codegen
# Use a codegen with a starter kit
hasura actions use-codegen --with-starter-kit true`,
SilenceUsage: true,
PreRunE: func(cmd *cobra.Command, args []string) error {
op := genOpName(cmd, "PreRunE")
err := ec.SetupCodegenAssetsRepo()
if err != nil {
return errors.E(
op,
fmt.Errorf(
"setting up codegen-assets repo failed (this is required for automatically generating actions code): %w",
err,
),
)
}
err = ec.SetupCodegenAssetsRepo()
if err != nil {
return errors.E(op, "setting up codengen assets repo failed")
}
// ensure codegen-assets repo exists
err = ec.CodegenAssetsRepo.EnsureCloned()
if err != nil {
return errors.E(
op,
fmt.Errorf(
"pulling latest actions codegen files from internet failed: %w",
err,View on GitHub (pinned to 724551b9ae)
Solutions
- Verify `git ls-remote https://github.com/hasura/codegen-assets` works from the same shell.
- Install/fix git and ensure it is on PATH.
- Configure proxy env (HTTPS_PROXY) or git http.proxy if behind a corporate proxy.
- Remove the existing codegen-assets clone dir and retry for a clean clone.
Defensive patterns
Strategy: retry
Validate before calling
command -v git >/dev/null && git ls-remote https://github.com/hasura/codegen-assets.git >/dev/null 2>&1
Try / catch
Catch, verify git/network, remove the stale clone, retry the command once.
Prevention
- Pre-warm the clone in CI with a manual git clone step.
- Cache the CLI home dir in CI caches.
When it happens
Trigger: Running `hasura actions use-codegen` offline, without git on PATH, behind a proxy blocking github.com, or with an unwritable/corrupted CLI home directory where the repo is cloned.
Common situations: Restricted corporate networks, CI without egress to github.com, broken proxy config, or a corrupted earlier clone in the CLI home dir.
Related errors
- pulling latest actions codegen files from internet failed: %
- pulling latest actions codegen files from internet failed: %
- unable to fetch introspection schema: %w
- error getting actions file content: %w
- error generating codegen for action %s: %w
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/0514512612c11c4d.
Report an issue: GitHub.