From 400 Errors to Reliable Results: Lessons Configuring AI Search

9 min read Troubleshooting Real Lessons

The first result said 400. The second result was the same. Then everything clicked.

If you are wiring FileFortress AI search to a local OpenAI-compatible runtime (like Foundry), the fastest path to success is understanding the difference between:

  • Provider/setup failures (endpoint, model, compatibility)
  • Prompt intent failures (query does not map to search filters)
Most Common Root Cause

A model name that looks right but does not exist on the configured endpoint. The request can be valid JSON and still fail with 400.

Lesson 1: Model IDs Must Match Exactly

In many local runtimes, model IDs include backend/runtime suffixes. A generic model alias can fail.

# Looks plausible, may fail
model = phi-4

# Exact endpoint model ID, works
model = phi-4-openvino-gpu:1

That single difference can convert repeated 400 responses into successful translations.

Lesson 2: Empty-Body 400 Does Not Mean \"No Clue\"

Some providers return 400 with no response body. It still usually points to one of these:

  • Model not available on endpoint
  • Unsupported request parameter
  • Endpoint/path mismatch

A practical checklist:

  1. Confirm endpoint health (foundry service status).
  2. Confirm model IDs from /v1/models.
  3. Set exact model with tools configure foundry --model ....
  4. Re-test prompt with --dry-run --explain.

Lesson 3: Some Queries Are Not Search Queries

Once model setup was fixed, one prompt still failed:

\"How many remotes do i have?\"

That is a valid product question, but not a file-filter request. The AI command is focused on mapping prompts to search criteria, so it correctly returned \"no filters extracted\".

Command Selection Matters
  • Use ai for file-search intent.
  • Use remotes list for remote inventory and count.

Lesson 4: Dry-Run and Explain Are Your Fastest Debug Tools

These options turn debugging from guesswork into a deterministic loop:

# Validate interpretation only
filefortress ai "find images smaller than 5kb" --dry-run

# Inspect reasoning
filefortress ai "find images smaller than 5kb" --dry-run --explain

Once interpretation looks correct, execute without dry-run.

A Repeatable Recovery Workflow

  1. Fix provider correctness (endpoint + exact model ID).
  2. Validate with small, obvious prompt.
  3. Use dry-run + explain for each new prompt shape.
  4. Switch to explicit search flags when determinism is required.

Related Resources

Turn AI Errors Into Fast Iteration

Diagnose model issues quickly, validate prompt mapping with dry-run, and keep search behavior predictable.