{"record":{"id":"27493cc5a73b1298","repo":"Tencent/WeKnora","slug":"sandbox-unsupported-remote-provider-q","errorCode":null,"errorMessage":"sandbox: unsupported remote provider %q","messagePattern":"sandbox: unsupported remote provider %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sandbox/session_manager.go","lineNumber":142,"sourceCode":"\tif cfg == nil {\n\t\tcfg = DefaultConfig()\n\t}\n\tif err := ValidateConfig(cfg); err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid sandbox config: %w\", err)\n\t}\n\tif deps.Client == nil {\n\t\treturn nil, errors.New(\"session bound manager requires a RemoteSandboxClient\")\n\t}\n\tif deps.Store == nil {\n\t\treturn nil, errors.New(\"session bound manager requires a SessionSandboxBindingStore\")\n\t}\n\tif deps.Checker == nil {\n\t\treturn nil, errors.New(\"session bound manager requires a SessionExistenceChecker\")\n\t}\n\n\tprovider := deps.Client.Provider()\n\tif !isRemoteProvider(provider) {\n\t\treturn nil, fmt.Errorf(\"sandbox: unsupported remote provider %q\", provider)\n\t}\n\n\t// Apply the provider's tuning defaults so downstream code reads only\n\t// non-zero TTL / timeout fields. Endpoint defaults are deliberately not\n\t// applied here: this constructor also serves named configs, which must be\n\t// told what they are missing rather than handed a built-in localhost value.\n\tswitch provider {\n\tcase SandboxTypeCube:\n\t\tapplyCubeRuntimeDefaults(cfg)\n\tcase SandboxTypeE2B:\n\t\tapplyE2BRuntimeDefaults(cfg)\n\tcase SandboxTypeDocker:\n\t\tapplyDockerRuntimeDefaults(cfg)\n\t}\n\n\t// Build the provider-specific neutral create request using the\n\t// provider's own template and TTL fields.\n\tcreateRequest, err := buildSessionCreateRequest(provider, cfg)","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/sandbox/session_manager.go#L124-L160","documentation":"Provider identity comes from deps.Client.Provider(). If that provider is not one of the supported remote providers (Cube, E2B, Docker remote), the constructor rejects it — the manager cannot build a provider-specific create request or apply provider defaults for an unknown type.","triggerScenarios":"Wiring NewSessionBoundManager with a RemoteSandboxClient whose Provider() returns an unsupported/custom/local value — e.g. a stub client in tests, a custom client wrapper forgetting to forward the real provider, or Config.Type / client mismatch after refactoring.","commonSituations":"Test fakes returning empty Provider() strings; custom client implementations not registered as a remote provider; switching backends via config while the injected client still reports the old provider.","solutions":["Make deps.Client.Provider() return one of the supported remote provider identifiers","If using a test fake, set its Provider() to a real provider type (e.g. SandboxTypeDocker)","Check whether a client wrapper/middleware is dropping or altering the provider value","Verify you did not intend the non-remote manager constructor for this provider type"],"exampleFix":"// before\nfunc (f *fakeClient) Provider() string { return \"\" }\n// after\nfunc (f *fakeClient) Provider() string { return sandbox.SandboxTypeDocker }","handlingStrategy":"validation","validationCode":"supported := map[string]bool{\"cube\": true, \"e2b\": true, \"docker\": true}\nif !supported[deps.Client.Provider()] {\n    return nil, fmt.Errorf(\"provider %q unsupported for session-bound manager\", deps.Client.Provider())\n}","typeGuard":null,"tryCatchPattern":"mgr, err := sandbox.NewSessionBoundManager(deps)\nif err != nil && strings.Contains(err.Error(), \"unsupported remote provider\") {\n    return nil, fmt.Errorf(\"wire a client whose Provider() is a supported remote type: %w\", err)\n}","preventionTips":["Assert Client.Provider() in tests before constructing managers","Keep client wrappers transparent about Provider()","Only use NewSessionBoundManager for remote providers; use the appropriate constructor otherwise"],"tags":["go","configuration","provider","validation"],"backgroundTag":"unsupported-provider","analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}