Golem troubleshoot build

From golemcloud/golem · View interactive version

Golem troubleshoot build is an AI agent skill from the GitHub repository golemcloud/golem. Troubleshooting Golem build failures and debugging manifest file (golem.yaml) configuration. Use when a build fails, when environment variables or config values are not applied as expected, when diagnosing why a manifest property has the wrong value, or when using `golem component manifest-trace` to

How to use this skill

Skill file

Troubleshooting Golem Build Failures

Both golem and golem-cli can be used — all commands below work with either binary.

For the normal build workflow and golem build usage, load golem-build. This skill focuses on what to do when that build fails.

Build Pipeline Overview

golem build executes a multi-step pipeline. Understanding which step failed is the first step to diagnosing problems:

  1. Check — proposes dependency and configuration fixes first, then verifies build tools
  2. Build — runs language-specific compilation commands to produce componentWasm, the final artifact used unchanged for metadata extraction and upload, without an output-copy stage
  3. Generate Bridge — generates bridge SDK code for inter-component communication

Run a single step in isolation with --step:

golem build --step check --yes      # Run only the check step
golem build --step build --yes      # Run only the build step

Build Tool Requirement Checks (After Dependency Fixes)

The check step verifies that required system tools are installed and meet minimum version requirements. The checks are language-specific:

Rust Projects

| Tool | Check | Install Hint |

|------|-------|--------------|

| rustc | rustc --version (minimum version enforced) | rustup install stable && rustup default stable |

| cargo | cargo version (minimum version enforced) | Installed with Rust toolchain |

| wasm32-wasip2 target | rustup target list --installed | rustup target add wasm32-wasip2 |

TypeScript and Effect Projects

| Tool | Check | Install Hint |

|------|-------|--------------|

| node | node --version (minimum version enforced) | https://nodejs.org/ |

| npm | npm --version (minimum version enforced) | Installed with Node.js |

MoonBit Projects

| Tool | Check | Install Hint |

|------|-------|--------------|

| moon | moon version (minimum version enforced) | https://docs.moonbitlang.com |

| wasm-tools | wasm-tools --version (minimum version enforced) | https://github.com/bytecodealliance/wasm-tools |

If a tool is missing or below the minimum version, the check step fails with an error message and an install hint. To skip these checks (e.g., if you know tools are installed but detection fails), use --skip-check.

Dependency Validation and Auto-Fix (Before Tool Checks)

Before tool checks, golem build validates project dependencies and can apply confirmed fixes. Accepted writes can remain even if a later tool check fails. Rust target detection can use rustup, but there is no separate minimum-version check for rustup itself.

Rust Dependency Checks

The CLI inspects every Rust component's Cargo.toml (and workspace Cargo.toml if present) for:

If dependencies are outdated or missing required features, the CLI shows a diff and prompts for confirmation before applying fixes.

TypeScript Dependency Checks

The CLI inspects the root package.json for:

The CLI also validates tsconfig.json settings:

Effect Dependency Checks

The CLI inspects the root package.json for @golemcloud/effect-golem, effect, and the shared Rollup/TypeScript build tooling. Effect components require compilerOptions.moduleResolution to be "bundler", but do not require the TypeScript SDK package.

AGENTS.md and Skill Files

The CLI checks that the project's AGENTS.md and .agents/skills/ directory contain up-to-date content matching the current CLI version's templates. Stale guidance updates are part of the confirmation-controlled dependency and configuration fix plan; --yes accepts them.

Checking and Applying Fixes Without Compilation

Run the check step alone to validate and apply fixes without compiling components. This is not a dry run: --yes accepts dependency and configuration writes, including template guidance updates. Omit --yes to review the proposed dependency fixes at the confirmation prompt and decline them; do not treat the check step as a read-only inspection command.

golem build --step check --yes

Common Build Errors and Solutions

"X is not available" / Tool Not Found

The CLI cannot find a required tool. Check that it is installed and on your PATH:

which cargo     # Rust
which node      # TypeScript or Effect
which moon      # MoonBit

"X version could not be detected"

The CLI found the tool but could not parse its version. This usually means a non-standard version string. Try updating the tool.

Missing Rust Target

rust target wasm32-wasip2 is not installed

Fix: rustup target add wasm32-wasip2

Dependency Version Mismatch

The CLI shows a diff of the changes it wants to make. Review the diff — it will update version numbers or add missing features. Pass --yes to auto-accept.

TypeScript or Effect `tsconfig.json` Issues

If moduleResolution is not set to "bundler", the build will fail during type checking. The CLI auto-fixes this during the check step.

Up-to-Date Check Confusion

golem build tracks file hashes to skip unchanged steps. If files were modified outside the build (e.g., by cargo build), the check may be stale. Force a full rebuild:

golem build --force-build --yes

Or clean and rebuild:

golem clean
golem build --yes

Diagnosing Manifest Configuration Issues with `manifest-trace`

When environment variables, config, plugins, or files are not what you expect at runtime, use manifest-trace to see exactly how the manifest configuration is resolved:

golem component manifest-trace

This command outputs a detailed trace for each component, and for each agent type of a built component, showing:

Example Usage

# Trace all components
golem component manifest-trace

# Trace one component
golem component manifest-trace app:main

# Build the component first, so that the trace includes its agent types
golem component manifest-trace app:main --build

What to Look For

  1. Missing environment variables: Check the env property trace to see if the variable was defined in a layer that was overridden or replaced by a later layer
  2. Wrong config values: Check the config property trace — a later layer may have replaced the entire config object instead of merging individual fields
  3. Plugin not applied: Check the plugins property trace to see if the plugin was defined in a layer that is not in the appliedLayers list (e.g., an environment that is not active)
  4. Unexpected merge behavior: Check envMergeMode, pluginsMergeMode, or filesMergeMode — these control whether later layers merge with or replace earlier values
  5. Wrong permissions: Check the initialCard trace of the agent type under agents. The most specific layer that sets a card replaces the inherited card completely, and an agent with no card in any layer gets the default card
  6. Preset not active: Verify that the expected preset appears in appliedLayers — if it is missing, it may not be set as the default or selected via the environment

Combining with Environment Selection

To see how the trace changes under a specific environment:

golem component manifest-trace -E staging

This activates the staging environment's presets, letting you verify that environment-specific overrides are applied correctly.

Related Skills

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.