microsoft/semantic-kernel · error · Exception

Missing required configuration. HOST and PORT must be set.

Error message

Missing required configuration. HOST and PORT must be set.

What it means

A generic Exception raised by Config.validate() when HOST or PORT is falsy. Note the Config class provides defaults (HOST='localhost', PORT=8080), so this only triggers if HOST is explicitly set to an empty string or PORT is set to a falsy value like 0 — i.e. an explicit misconfiguration rather than a missing one.

Source

Thrown at python/samples/demos/copilot_studio_skill/src/api/config.py:36

    # and must match these named as Bot configuration expects
    APP_ID = os.getenv("BOT_APP_ID")
    APP_PASSWORD = os.getenv("BOT_PASSWORD")
    APP_TENANTID = os.getenv("BOT_TENANT_ID")
    APP_TYPE = os.getenv("APP_TYPE", "singletenant")

    # Required for Copilot Skill
    # Can be a list of allowed agent Ids,
    # or "*" to allow any agent
    ALLOWED_CALLERS = os.getenv("ALLOWED_CALLERS", ["*"])

    # Required for Azure OpenAI
    AZURE_OPENAI_CHAT_DEPLOYMENT_NAME = os.getenv("AZURE_OPENAI_CHAT_DEPLOYMENT_NAME")
    AZURE_OPENAI_ENDPOINT = os.getenv("AZURE_OPENAI_ENDPOINT")
    AZURE_OPENAI_API_VERSION = os.getenv("AZURE_OPENAI_API_VERSION")

    def validate(self):
        if not self.HOST or not self.PORT:
            raise Exception("Missing required configuration. HOST and PORT must be set.")
        if not self.APP_ID or not self.APP_PASSWORD or not self.APP_TENANTID:
            raise Exception("Missing required configuration. APP_ID, APP_PASSWORD, and APP_TENANT_ID must be set.")

        if not self.ALLOWED_CALLERS:
            raise Exception("Missing required configuration. ALLOWED_CALLERS must be set.")


config = Config()
config.validate()

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Set HOST to a real hostname/IP (or unset it to accept the 'localhost' default).
  2. Set PORT to a positive integer (or unset to accept 8080).
  3. Remove empty HOST=/PORT= lines from your .env.

Example fix

// before
HOST=
PORT=0

// after
HOST=0.0.0.0
PORT=8080
Defensive patterns

Strategy: validation

Validate before calling

import os
host = os.getenv('HOST')
port = os.getenv('PORT')
if host == '' or port in ('', '0'):
    raise SystemExit("HOST must be non-empty and PORT a positive integer.")

Type guard

def is_valid_host_port(h, p) -> bool:
    return bool(h) and str(p).isdigit() and int(p) > 0

Prevention

When it happens

Trigger: Setting HOST='' (empty) or PORT=0 in the environment, making `not self.HOST` or `not self.PORT` true during the module-level config.validate() call.

Common situations: A deployment template sets HOST to an empty variable; PORT set to 0 inadvertently; .env with HOST= (blank).

Related errors


AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13). Data as JSON: /api/errors/0be7e69b02e83ee7. Report an issue: GitHub.