Fix: Offline Install CLI Server Fails To Start

by Alex Johnson 47 views

It can be incredibly frustrating when a new installation, especially an offline one, doesn't start up as expected. You've meticulously followed the steps, checked all the boxes, and yet, when you try to launch the MIRA CLI server, you're met with a disheartening "fail to start server" message. This is precisely the scenario taylorsatula and mira-OSS encountered after a fresh offline installation on Ubuntu 24.04.1 LTS, even with all installation checks reporting green. The subsequent dive into the logs revealed a peculiar issue: the system seemed to be searching for API keys, which is counterintuitive for an offline setup. The error message, specifically a KeyError: "Field 'None' not found in secret 'mira/api_keys'. Available: anthropic_batch_key, anthropic_key, mira_api, provider_key", originating from vault_client.py, points to a configuration problem where the system is trying to access a secret path (mira/api_keys) but cannot find the required fields within it, or perhaps the path itself is malformed or not populated correctly during the offline installation process. This suggests that even in an offline environment, some configuration or initialization steps might be implicitly relying on or attempting to access credential-related structures, or that the offline install process itself didn't correctly set up or acknowledge the absence of these external dependencies.

Understanding the Root Cause: API Key References in Offline Mode

The core of the problem lies in the KeyError that indicates the MIRA CLI server is trying to retrieve API keys from a vault, even though the installation was explicitly configured for offline use. The log snippet KeyError: "Field 'None' not found in secret 'mira/api_keys'. Available: anthropic_batch_key, anthropic_key, mira_api, provider_key" is particularly telling. It signifies that the vault_client.py script, when attempting to fetch a secret, is looking for specific fields (like anthropic_batch_key, anthropic_key, etc.) within a secret path named mira/api_keys. The fact that it's encountering a KeyError suggests that either the mira/api_keys path doesn't exist in the offline vault configuration, or it exists but is empty, or the specific field it's trying to access (indicated as 'None' here, which is unusual and might be a symptom of a deeper issue) is not present. For an offline installation, the expectation is that all necessary components and configurations would be self-contained and not dependent on external API keys or cloud-based vault services. The presence of this error implies a potential oversight in the offline installation script's handling of credential management. It might be that certain modules or startup scripts are hardcoded to look for these keys regardless of the installation mode, or that the offline configuration process for the vault itself was incomplete, leading to this lookup failure. It's also possible that the installation process, while marked as