{"record":{"id":"f6de1ea3338f5e8f","repo":"github/copilot-sdk","slug":"session-fs-conventions-must-be-either-posix-or","errorCode":null,"errorMessage":"session_fs.conventions must be either 'posix' or 'windows'","messagePattern":"session_fs\\.conventions must be either 'posix' or 'windows'","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/copilot/client.py","lineNumber":422,"sourceCode":"    if provider is not None:\n        singular = provider.get(\"bearer_token_provider\")\n        if singular is not None:\n            callbacks[_DEFAULT_BEARER_TOKEN_PROVIDER_NAME] = singular\n    if providers:\n        for named in providers:\n            callback = named.get(\"bearer_token_provider\")\n            if callback is not None:\n                callbacks[named[\"name\"]] = callback\n    return callbacks\n\n\ndef _validate_session_fs_config(config: SessionFsConfig) -> None:\n    if not config.get(\"initial_working_directory\"):\n        raise ValueError(\"session_fs.initial_working_directory is required\")\n    if not config.get(\"session_state_path\"):\n        raise ValueError(\"session_fs.session_state_path is required\")\n    if config.get(\"conventions\") not in (\"posix\", \"windows\"):\n        raise ValueError(\"session_fs.conventions must be either 'posix' or 'windows'\")\n\n\ndef _mcp_servers_to_wire(\n    servers: dict[str, Any],\n) -> dict[str, Any]:\n    \"\"\"Convert MCP server configs from public API format to wire format.\n\n    Renames ``working_directory`` key to ``cwd`` in each server config dict.\n    \"\"\"\n    wire: dict[str, Any] = {}\n    for name, config in servers.items():\n        if \"working_directory\" in config:\n            config = {**config, \"cwd\": config[\"working_directory\"]}\n            del config[\"working_directory\"]\n        wire[name] = config\n    return wire\n\n","sourceCodeStart":404,"sourceCodeEnd":440,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/python/copilot/client.py#L404-L440","documentation":"This ValueError is raised by _validate_session_fs_config when the SessionFsConfig passed to CopilotClient has a 'conventions' key that is not exactly 'posix' or 'windows'. The library uses this field to pick path-handling rules for the session filesystem, so an unknown value cannot be safely interpreted and construction is aborted in __init__.","triggerScenarios":"Constructing CopilotClient with a session_fs config whose 'conventions' is misspelled (e.g. 'POSIX', 'Unix', 'win32', 'nt'), None, omitted casing variants, or loaded from a YAML/JSON config file with an unexpected string.","commonSituations":"Hand-editing a config file with OS-specific naming habits ('win32', 'nt'), building the dict programmatically from an env var like os.name ('posix'/'nt' — note os.name returns 'nt' on Windows, not 'windows'), or copy-pasting config between platforms.","solutions":["Set session_fs.conventions to exactly 'posix' or 'windows' (lowercase)","If deriving the value from the OS, map it explicitly: {'nt': 'windows'}.get(os.name, 'posix')","Check the config file/env source for typos or surrounding whitespace and strip/normalize the string"],"exampleFix":"// before\nconfig = {\"session_fs\": {\"initial_working_directory\": \"/tmp\", \"session_state_path\": \"/tmp/s\", \"conventions\": os.name}}\n// after\nconventions = \"windows\" if os.name == \"nt\" else \"posix\"\nconfig = {\"session_fs\": {\"initial_working_directory\": \"/tmp\", \"session_state_path\": \"/tmp/s\", \"conventions\": conventions}}","handlingStrategy":"validation","validationCode":"cfg = opts.get(\"session_fs\", {})\nif cfg.get(\"conventions\") not in (\"posix\", \"windows\"):\n    raise ValueError(f\"conventions must be 'posix' or 'windows', got {cfg.get('conventions')!r}\")\nif not cfg.get(\"initial_working_directory\") or not cfg.get(\"session_state_path\"):\n    raise ValueError(\"session_fs requires initial_working_directory and session_state_path\")","typeGuard":"def is_valid_session_fs_config(cfg: dict) -> bool:\n    return (\n        cfg.get(\"conventions\") in (\"posix\", \"windows\")\n        and bool(cfg.get(\"initial_working_directory\"))\n        and bool(cfg.get(\"session_state_path\"))\n    )","tryCatchPattern":null,"preventionTips":["Map os.name to the library's vocabulary explicitly ('nt' -> 'windows')","Normalize/strip config strings loaded from files or env vars","Validate the full session_fs dict before constructing CopilotClient"],"tags":["python","config-validation","client-init"],"backgroundTag":"invalid-enum-value","analyzedSha":"cd8cf15dc3f9e762615790aaed0a771a0f392755","analyzedAt":"2026-09-09T18:32:31.973Z","contentChangedAt":"2026-09-09T18:32:31.973Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}