#3769·ogx

startup crash when config registers a model and provider returns an exception

Author: mattfCreated Oct 10, 2025Updated Sep 23, 2026
Labelsbugstale

System Info

n/a

Information

  • The official example scripts
  • My own modified scripts

Describe the bug

setup

  • config with a model
  • a provider that returns an error from /v1/models

result: stack fails to start

root cause: stack follows the same path for user initiated model registration and config initiated registration. in both cases the adapter gets a chance to veto the registration with an exception. when user initiated registration is rejected the exception propagates back to the user. when config initiates registration the exception results in terminated startup.

example config -

version: 2
image_name: config-registered-models
apis:
- inference
providers:
  inference:
  - provider_id: openai
    provider_type: remote::openai
    config:
      api_key: BOGUS
metadata_store:
  type: sqlite
  db_path: /tmp/config-registered-model.db
models:
- model_id: test-model
  provider_id: openai
  provider_model_id: custom-model
  model_type: llm

Error logs

$ llama stack run config-registered-models.yaml
...
ERROR    2025-10-10 09:26:10,936 llama_stack.providers.utils.inference.openai_mixin:439 providers::utils:               
         OpenAIInferenceAdapter.list_provider_model_ids() failed with: Error code: 401 - {'error': {'message':          
         'Incorrect API key provided: BOGUS. You can find your API key at                                               
         https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code':        
         'invalid_api_key'}}

                
Traceback (most recent call last):
  File ".../llama", line 10, in <module>
    sys.exit(main())
             ^^^^^^
...
  File ".../openai/_base_client.py", line 1594, in request
    raise self._make_status_error_from_response(err.response) from None
openai.AuthenticationError: Error code: 401 - {'error': {'message': 'Incorrect API key provided: BOGUS. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}}

[stack exits]

Expected behavior

running stack with model from config unconditionally registered