Skip to content
Agentmart
Submit a tool

mongo-failure-investigator

Investigates MongoDB test failures from a local log file (./tests.log).

Skill by enricogolfieri

IndexedUnlicense★ 1
Write a review

Chalk Labs

Need help deploying mongo-failure-investigator?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/enricogolfieri-mongo-failure-investigator

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Investigates MongoDB test failures from a local log file (./tests.log). Use this skill whenever the user says "investigate the test failure", "why did the test fail", "investigate the logs", "look at what failed", or anything pointing to a test failure that needs root cause analysis. Do not wait for an explicit request — if the user mentions a test failure and ./tests.log is present, invoke this skill immediately. This skill has two phases: Phase 1 is investigation (root cause + code pointers), Phase 2 is writing a repro — and Phase 2 only happens if the user explicitly agrees with the Phase 1 hypothesis.

Use cases: testing, writing

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/mongo-failure-investigator

What's inside

Skill name
mongo-failure-investigator
Description
Investigates MongoDB test failures from a local log file (./tests.log). Use this skill whenever the user says "investigate the test failure", "why did the test fail", "investigate the logs", "look at what failed", or anything pointing to a test failure that needs root cause analysis. Do not wait for an explicit request — if the user mentions a test failure and ./tests.log is present, invoke this skill immediately. This skill has two phases: Phase 1 is investigation (root cause + code pointers), Phase 2 is writing a repro — and Phase 2 only happens if the user explicitly agrees with the Phase 1 hypothesis.
License
Unlicense
Instructions
129 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# MongoDB Test Failure Investigator

Test logs are large. Never read `./tests.log` whole — always use targeted grep
to extract only the relevant signal.

---

## Phase 1: Investigation

### Step 1 — Triage the log

Grep `./tests.log` with this pattern to surface all failure-relevant lines:

```
Task completed - FAILURE|failed to load|invariant|fassert|invalid access|BACKTRACE|\d+ threads? with tid|checkReplicatedDataHa|Tripwire assertion
```

Use at least 30 lines of context around each match (`-C 30`).

This gives you:
- The failure type and message
- Stack frames surrounding a crash
- The test name embedded in the log prefix `[js_test:<name>]`

Also scan near the top of the log for the resmoke invocation line:
```
resmoke.py run ... jstests/path/to/test.js
```
That gives you the exact file path of the test being run.

**Important**: if you see both `fassert`/`BACKTRACE` and `failed to load` for the
same test, the `failed to load` is a consequence of the crash — ignore it and
focus on the real failure.

### Step 2 — Read the failing test

From the resmoke invocation line, get the test file path and read it. You want to
understand:
- What the test is verifying
- The topology it sets up (standalone, replica set, sharded)
- The specific operations and assertions it exercises

### Step 3 — Failure-specific deep dive

Apply the strategy that matches the failure type from Step 1:

#### Crash — `fassert` / `invariant` / `BACKTRACE`

1. Extract the full backtrace from the log (all `#NN 0x... in ...` lines)
2. Skip the first ~10 frames (signal/stacktrace plumbing) — start from the first
   `mongo::` application-code frame
3. Walk up the call chain from the `fassert`/`invariant` frame to understand which
   function triggered it and what state it was checking
4. Read the relevant C++ source around the failing assertion
5. Pay particular attention to locking: `lockGlobal`, `DBLock`, `GlobalLock` in
   the backtrace often indicate a lock-ordering violation or re-entrant locking issue

#### JS assertion failure

1. Find the JS stack trace in the log (distinct from any C++ backtrace)
2. Identify the exact `assert.*()` call that fired and its expected vs. actual values
3. Trace back through the test to understand what operation produced the unexpected result
4. Look at server-side log lines near the same timestamp for additional context

#### Timeout

1. Find what the test was waiting for when it timed out
2. Grep for `\d+ threads? with tid` — thread dumps often reveal deadlocked or stalled threads
3. Look at lock acquisition patterns in the log lines immediately preceding the timeout
4. Assess whether the operation was making any progress or was completely stuck

#### Data inconsistency — `checkReplicatedDataHa` / Tripwire

1. Identify which replica set members diverged
2. Look for replication lag signals or oplog gaps in the surrounding lines
3. Note the oplog operation that was being applied when divergence occurred

### Step 4 — Root cause summary

Present findings in this format — be specific, not verbose:

```
Failing test: jstests/path/to/test.js
Failure type: [crash | js assertion | timeout | data inconsistency]
Root cause: <1–3 sentences: what went wrong and why>
Key evidence: <2–3 most revealing log lines>
Code pointers: <file:line references to relevant source>
```

If the evidence is ambiguous, say so explicitly and describe what would
disambiguate it. Do not speculate beyond what the logs and code show.

Stop here. Phase 2 only begins if the user confirms they agree with the hypothesis.

---

## Phase 2: Repro (only when the user explicitly agrees with the Phase 1 hypothesis)

Create a minimal test that reproduces the failure:

**File**: `jstests/repro.js`

**Rules**:
- Spin up the topology that matches the failure: `ReplSetTest` for replication
  issues, `ShardingTest` for sharding issues, `MongoRunner` for standalone
- Reproduce the specific failure with the smallest possible setup
- No extra assertions, no unrelated cleanup, no surrounding noise
- The test should fail when the bug is present (and ideally pass when it is fixed)

**Reference patterns**:
```js
// Replica set topology
import {ReplSetTest} from "jstests/libs/replsettest.js";
const rst = new ReplSetTest({nodes: 2});
rst.startSet();
rst.initiate();
// ... reproduce the failure ...
rst.stopSet();

From enricogolfieri/workspace-mongo, Unlicense.

More from enricogolfieri/workspace-mongo

Signals

Stars
1
Forks
0
Open issues
0
Last commit (this folder)
Jun 15, 2026 (4 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
Unlicense
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from enricogolfieri

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get mongo-failure-investigator running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying mongo-failure-investigator?

CallGet help
Cite this page

mongo-failure-investigator skill. Agent Mart. https://agentmart.dev/skills/enricogolfieri-mongo-failure-investigator (last updated 2026-10-24)