Skip to content

Bug: utility_model.api_base empty string causes AuthenticationError cascade + self-repair IndentationError (NVIDIA NIM users) #1360

@MrTrenchTrucker

Description

@MrTrenchTrucker

Summary

Agent Zero v1.x silently routes utility_model calls to api.openai.com when
utility_model.api_base is an empty string (""). For users running NVIDIA NIM models (key prefix
nvapi-), this causes a repeated AuthenticationError flood on every background memory call.

Agent Zero correctly diagnosed the problem and attempted autonomous self-repair — adding try/except AuthenticationError guards to _50_recall_memories.py and _51_memorize_solutions.py. The logic
was correct, but the patch was written with 1-space Python indentation instead of 8-space,
causing an IndentationError on the next extension load. This blocked all agent responses
entirely
.

Root Causes

  1. utility_model.api_base: "" in _model_config/config.json → LiteLLM silent fallback to
    api.openai.com
  2. Extension loader raises IndentationError/SyntaxError globally — one broken file blocks ALL
    extensions
  3. Self-repair has no py_compile validation step before activating a patched file

Impact

  • NVIDIA NIM users with provider: openai + NVIDIA key + empty utility_model.api_base will see
    repeated AuthenticationError in logs after every response
  • If Agent Zero attempts autonomous self-repair, the indentation bug in the output causes complete
    agent failure
  • Memory recall and memorization silently fail or crash background threads throughout

Proposed Fixes

Full white paper, root cause analysis, corrected extension files, and A0's self-generated diagnostic
documents:
https://github.com/MrTrenchTrucker/agent-zero-nvidia-routing-fix

Short version:

  1. Config validator at startup — warn/error if utility_model.api_base is empty or key prefix
    mismatches endpoint
  2. Graceful extension loader — catch IndentationError/SyntaxError per-extension, skip broken
    file, continue loading others
  3. Self-repair safety — run py_compile on patched files before activating, restore original on
    failure
  4. Core AuthenticationError guard — the nvapi- detection logic should live in core, not
    patched per-file

Environment

  • Agent Zero v1.x (agent0ai/agent-zero:latest)
  • LiteLLM with NVIDIA NIM (provider: openai, api_base: https://integrate.api.nvidia.com/v1)
  • utility_model.api_base unset / empty string in _model_config/config.json

Verified Fix

Full recovery performed and confirmed. Post-recovery functional test: memory save/recall, sub-agent
delegation, and Docker socket access all passed. Corrected .py files with proper indentation +
AuthenticationError guards are in the repo above.

A fork with the code changes ready for review is at:
https://github.com/MrTrenchTrucker/agent-zero

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions