Prompt

How do I troubleshoot a build that works locally but fails in CI?

Technology / CI/CD & DevOps1 observationLast seen Oct 19, 2026

Latest observation

Oct 19, 2026OpenAI APIWeb search: off

A good way to troubleshoot “works locally, fails in CI” is to assume the two environments are not actually the same and then systematically narrow down the differences.

1) Compare the environments first

Check these between local and CI:

  • OS / base image
  • Language/runtime versions
    • Node, Python, Java, .NET, Go, Rust, etc.
  • Dependency versions
    • Lockfile used? Re-resolved in CI?
  • Build tools
    • npm/yarn/pnpm, pip/poetry, gradle/maven, cargo, make, etc.
  • Environment variables / secrets
    • Missing or different values in CI
  • File system behavior
    • Case sensitivity, path separators, permissions
  • Network access
    • CI may not access private registries, APIs, or git submodules

2) Make CI reproduce locally

Try to run the build in an environment as close to CI as possible:

  • Use the same Docker image or runner image
  • Use the same command CI runs
  • Use the same environment variables
  • Use a clean workspace:
    • delete node_modules, build artifacts, caches
    • use a fresh clone if possible

If it fails locally in that environment, you’ve already won half the battle.

3) Inspect the exact failing step

Don’t focus only on the final failure message. Look for:

  • the first error
  • warnings right before the failure
  • any command that succeeds locally but not in CI because of shell differences

Tip: add verbose/debug flags:

  • npm ci --verbose
  • pytest -vv
  • mvn -X
  • gradle --info --stacktrace
  • cargo build -vv

4) Check dependency installation

A very common cause is dependency drift.

Questions to ask:

  • Is CI using the lockfile exactly?
    • npm ci vs npm install
    • pip install -r requirements.txt vs unpinned ranges
  • Are packages pulled from a different registry?
  • Is there a private dependency or git submodule missing?
  • Did a transitive dependency update unexpectedly?

Best practice:

  • pin versions
  • commit lockfiles
  • avoid “latest” in CI

5) Look for case-sensitivity and path issues

CI is often Linux, while local dev may be macOS/Windows.

Common problems:

  • import Foo vs file foo.js
  • src/Utils vs src/utils
  • hardcoded C:\... or /Users/...
  • relative paths that depend on working directory

6) Check permissions and ownership

CI runners may run as a different user or with restricted permissions.

Watch for:

  • writing to protected directories
  • needing chmod +x on scripts
  • executable bit missing in git
  • temp directory access
  • bind-mounted volume permissions in Docker

7) Review environment variables and secrets

A build can fail if CI lacks:

  • API keys
  • feature flags
  • proxy settings
  • custom registry credentials
  • HOME, CI, NODE_ENV, PATH

Make sure secrets are:

  • actually configured
  • available to the right job/stage
  • not accidentally masked or expired

8) Check shell and scripting differences

CI may use a different shell than your local terminal.

Examples:

  • bash vs sh
  • PowerShell vs cmd.exe
  • multiline command quoting differences
  • set -e behavior
  • pipefail not enabled

Make scripts explicit about the shell they expect.

9) Eliminate cache issues

CI caches can cause confusing behavior.

Try:

  • disabling cache once
  • clearing dependency caches
  • rebuilding from scratch
  • invalidating Docker layers if needed

If the build passes after cache clear, the problem may be stale artifacts or mismatched cache keys.

10) Add logging and artifacts

If the failure is hard to reproduce:

  • print versions:
    • node -v, python --version, java -version
  • print working directory and environment
  • upload logs and build artifacts
  • save intermediate outputs
  • capture test reports, coverage, and stack traces

11) Minimize the problem

Reduce the build to the smallest failing case:

  • one test
  • one module/package
  • one build target
  • one dependency

This often reveals the issue quickly.

12) Common root causes checklist

Here’s a quick checklist of frequent culprits:

  • Different language/runtime version
  • Missing lockfile or dependency drift
  • Case-sensitive file path issue
  • Missing env var or secret
  • Permission/executable-bit issue
  • Hidden assumption about working directory
  • CI uses clean checkout, local uses stale files
  • Cache corruption or stale artifacts
  • Network/private registry access problem
  • OS-specific behavior
  • Shell quoting/command syntax difference

Practical debugging pattern

A reliable workflow is:

  1. Copy the CI command locally
  2. Run it in a clean environment
  3. Add verbose logs
  4. Compare versions and env vars
  5. Remove caching
  6. Minimize until the failure is obvious

If you want, I can also give you:

  • a CI troubleshooting checklist template
  • specific steps for GitHub Actions / GitLab CI / Jenkins
  • or help debug a specific error log if you paste it here.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.