Fosowl/agenticSeek · error · Exception
{str(e)} Error occured with server route. Are you using the
Error message
{str(e)}
Error occured with server route. Are you using the correct address for the config.ini provider? What it means
In Provider.server_fn (sources/llm_provider.py:160), a KeyError raised while talking to the remote '/setup', '/generate', or '/get_updated_sentence' routes is re-raised as 'Error occured with server route. Are you using the correct address for the config.ini provider?'. The library raises it when an expected JSON key (e.g. 'sentence', 'is_complete', 'error') is missing from a server response, and interprets that as a wrong-server/mismatched-route problem.
Source
Thrown at sources/llm_provider.py:160
try:
response = requests.get(f"{self.server_ip}/get_updated_sentence")
if "error" in response.json():
pretty_print(response.json()["error"], color="failure")
break
thought = response.json()["sentence"]
is_complete = bool(response.json()["is_complete"])
time.sleep(2)
except requests.exceptions.RequestException as e:
pretty_print(f"HTTP request failed: {str(e)}", color="failure")
break
except ValueError as e:
pretty_print(f"Failed to parse JSON response: {str(e)}", color="failure")
break
except Exception as e:
pretty_print(f"An error occurred: {str(e)}", color="failure")
break
except KeyError as e:
raise Exception(
f"{str(e)}\nError occured with server route. Are you using the correct address for the config.ini provider?") from e
except Exception as e:
raise e
return thought
def ollama_fn(self, history, verbose=False):
"""
Use local or remote Ollama server to generate text.
"""
thought = ""
if self.is_local:
server_port = self.server_address.split(":")[-1] if ":" in str(self.server_address) else "11434"
host = f"{self.internal_url}:{server_port}"
else:
host = f"http://{self.server_address}"
client = OllamaClient(host=host)
try:View on GitHub (pinned to ae57a23577)
Solutions
- Verify the server address in config.ini matches the agent backend server (correct scheme, host, and port).
- Start the companion server on the target machine and confirm /setup, /generate, /get_updated_sentence exist (curl the routes manually).
- Check that client and server are the same version — route response schemas may have changed.
- Inspect the raw JSON returned by /get_updated_sentence; if it lacks 'sentence'/'is_complete', the server errored — check the server logs.
- Ensure no reverse proxy or firewall is intercepting and returning its own error payload.
Example fix
// before (config.ini) [MAIN] server_address = 127.0.0.1:8000 // after: point at the actual agent backend port [MAIN] server_address = 127.0.0.1:8080
Defensive patterns
Strategy: validation
Validate before calling
import requests
def check_server_backend(address: str, model: str) -> bool:
"""Verify the remote agent backend exposes the expected routes/keys."""
base = address if address.startswith('http') else f'http://{address}'
try:
r = requests.post(f'{base}/setup', json={'model': model}, timeout=10)
if r.status_code != 200:
return False
r2 = requests.post(f'{base}/generate', json={'messages': [{'role': 'user', 'content': 'ping'}]}, timeout=10)
return r2.status_code == 200
except requests.RequestException:
return False Type guard
def is_valid_sentence_payload(payload: object) -> bool:
return (
isinstance(payload, dict)
and 'sentence' in payload
and 'is_complete' in payload
and isinstance(payload['is_complete'], bool)
) Try / catch
try:
res = provider.respond(history)
except Exception as e:
if 'server route' in str(e):
print(f"Wrong backend or schema mismatch at {provider.server_ip}: {e.__cause__}")
print("Check config.ini server_address and server version.")
else:
raise Prevention
- Confirm config.ini server_address points at the agent backend server, not another HTTP service.
- Keep client and server on matching versions so route response schemas agree.
- Curl /setup, /generate, /get_updated_sentence manually after deploying the server to verify the contract.
- Monitor the remote server's logs — a crashed worker returning partial JSON surfaces as this KeyError client-side.
When it happens
Trigger: Polling GET /get_updated_sentence returns JSON lacking 'sentence' or 'is_complete' keys (response.json()["sentence"] raises KeyError); pointing server_address at a server that isn't the expected agent backend (different API shape, or a proxy returning {'message': ...} error bodies).
Common situations: config.ini server address points to the wrong host/port or another HTTP service (a plain web server, nginx default page returning non-JSON handled oddly, or a different app version with changed route schemas); the remote agent server crashed mid-generation and returns partial JSON; version mismatch between client and server route contracts.
Related errors
- Missing or malformed Authorization header
- Invalid API token
- {str(e)} Connection to {self.server_ip} failed.
- LM Studio returned status {response.status_code}: {response.
AI-assisted analysis of Fosowl/agenticSeek@ae57a23577 (2026-08-30).
Data as JSON: /api/errors/f6c3501a3730449b.
Report an issue: GitHub.