{"record":{"id":"cd0063327d6f48c5","repo":"Tencent/WeKnora","slug":"create-remote-sandbox-w","errorCode":null,"errorMessage":"create remote sandbox: %w","messagePattern":"create remote sandbox: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sandbox/session_lifecycle.go","lineNumber":361,"sourceCode":"\tctx context.Context,\n\tkey SessionSandboxKey,\n) (RemoteSandboxHandle, error) {\n\trequest := l.createRequest\n\trequest.Metadata = nil\n\tif l.client.Capabilities().SupportsMetadata {\n\t\trequest.Metadata = cloneMetadata(l.createRequest.Metadata)\n\t\tif request.Metadata == nil {\n\t\t\trequest.Metadata = make(map[string]string)\n\t\t}\n\t\tfor metadataKey, value := range l.metadata(key) {\n\t\t\trequest.Metadata[metadataKey] = value\n\t\t}\n\t}\n\trequest.EnvVars = cloneMetadata(l.createRequest.EnvVars)\n\n\thandle, err := l.client.Create(ctx, request)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"create remote sandbox: %w\", err)\n\t}\n\tif err := l.validateHandle(handle, \"\"); err != nil {\n\t\treturn nil, errors.Join(err, l.cleanupCreated(ctx, handle))\n\t}\n\n\texists, checkErr := l.sessionChecker.SessionExists(ctx, key)\n\tif checkErr != nil {\n\t\treturn nil, errors.Join(\n\t\t\tfmt.Errorf(\"recheck owning session: %w\", checkErr),\n\t\t\tl.cleanupCreated(ctx, handle),\n\t\t)\n\t}\n\tif !exists {\n\t\treturn nil, errors.Join(ErrSandboxSessionDeleted, l.cleanupCreated(ctx, handle))\n\t}\n\n\tbinding := l.newBinding(\n\t\tkey,","sourceCodeStart":343,"sourceCodeEnd":379,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/sandbox/session_lifecycle.go#L343-L379","documentation":"This error wraps a failure from client.Create when no existing binding or orphaned sandbox could be recovered and the lifecycle proceeds to create a brand-new remote sandbox. If the provider's Create call fails, the error is returned as 'create remote sandbox: %w'. This is the provisioning entry point for remote sessions.","triggerScenarios":"client.Create(ctx, request) returns an error during createAndBind — quota/capacity exhausted, invalid template ID, invalid EnvVars or request fields, auth failures, network errors, or provider-region unavailability.","commonSituations":"Exceeded sandbox quota or account limit; template deprecated/renamed so createRequest.TemplateID no longer resolves; invalid environment variable names/values rejected by the provider; region outage; billing issue suspending provisioning.","solutions":["Inspect the wrapped error for provider-specific reasons (quota, invalid template, invalid env var)","Verify createRequest.TemplateID is valid and still exists on the provider","Check account quota/billing status with the provider","Retry with backoff if the error is transient (capacity/5xx); consider a fallback region or template"],"exampleFix":"// before\nrequest := RemoteCreateRequest{TemplateID: \"node-18\"} // deprecated template\n// after\nrequest := RemoteCreateRequest{TemplateID: currentTemplateID} // resolved from provider template list","handlingStrategy":"validation","validationCode":"// validate the create request before calling resolve\nif createReq.TemplateID == \"\" || !templateExists(ctx, client, createReq.TemplateID) {\n    return errors.New(\"invalid or missing template ID\")\n}\nfor k := range createReq.EnvVars {\n    if !validEnvName(k) { return fmt.Errorf(\"invalid env var name %q\", k) }\n}","typeGuard":"func validCreateRequest(r sandbox.RemoteCreateRequest) bool {\n    return r.TemplateID != \"\" && len(r.EnvVars) <= maxEnvVars\n}","tryCatchPattern":"handle, err := session.Resolve(ctx, key)\nif err != nil && strings.HasPrefix(err.Error(), \"create remote sandbox:\") {\n    if isQuotaError(err) { /* free capacity or request quota */ }\n    if isTransient(err) { err = retryWithBackoff(ctx, 3, func() error { handle, err = session.Resolve(ctx, key); return err }) }\n}","preventionTips":["Pin and periodically refresh template IDs from the provider's template list","Monitor account quota usage and set alerts","Validate env var names/values against provider rules before creation","Configure sandbox TTL to avoid hitting concurrent-sandbox limits"],"tags":["provisioning","remote-sandbox","provider-api","create-failure"],"backgroundTag":"sandbox-provisioning-failed","analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}