{"record":{"id":"37156f77722ac897","repo":"Wei-Shaw/sub2api","slug":"live-attestation-is-only-supported-when-sub2api-ru","errorCode":null,"errorMessage":"live attestation is only supported when Sub2API runs on macOS; Windows support is not implemented yet","messagePattern":"live attestation is only supported when Sub2API runs on macOS; Windows support is not implemented yet","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/internal/platform/liveattestation/attestation.go","lineNumber":9,"sourceCode":"package liveattestation\n\nimport (\n\t\"context\"\n\t\"errors\"\n)\n\nvar (\n\tErrUnsupportedPlatform = errors.New(\"live attestation is only supported when Sub2API runs on macOS; Windows support is not implemented yet\")\n\tErrChatGPTAppMissing   = errors.New(\"live attestation requires the official ChatGPT app on the Sub2API server\")\n)\n\n// Provider 在发起 Live 请求前生成 ChatGPT DeviceCheck attestation。\ntype Provider interface {\n\tCheck(ctx context.Context) error\n\tGenerate(ctx context.Context) (string, error)\n}\n","sourceCodeStart":1,"sourceCodeEnd":18,"githubUrl":"https://github.com/Wei-Shaw/sub2api/blob/073e92d17178a1ccdb0a27017f572f10c9c7ab62/backend/internal/platform/liveattestation/attestation.go#L1-L18","documentation":"ErrUnsupportedPlatform is returned by the liveattestation Provider when Sub2API is built/run on any OS other than macOS. Live-ChatGPT requests require Apple's DeviceCheck attestation, and only a macOS implementation exists (build-tag gated); Windows and Linux return this sentinel from Check/Generate.","triggerScenarios":"Deploying Sub2API on Linux or Windows and enabling/configuring the Live provider (or a Live account route); the platform-neutral file resolves because attestation_darwin.go is excluded by GOOS build tags, and the default provider returns ErrUnsupportedPlatform.","commonSituations":"Docker (Linux) deployments with Live accounts attached; CI environments attempting Live requests; migrating a working macOS setup to a Linux VPS; Windows Server deployments.","solutions":["Run the Sub2API instance that serves Live traffic on an Apple Silicon macOS host.","Remove/disable Live provider accounts on non-macOS deployments so requests route elsewhere or fail fast with a clear config error.","Gate Live features in your deployment config per-OS to surface this at startup rather than at request time.","Match with errors.Is(err, liveattestation.ErrUnsupportedPlatform) to render a clear 'Live requires macOS' message."],"exampleFix":"// before: Live enabled unconditionally\nprovider := live.New(cfg)\n\n// after: fail fast with a clear message on unsupported OS\nif _, err := provider.Check(ctx); err != nil {\n    if errors.Is(err, liveattestation.ErrUnsupportedPlatform) {\n        log.Fatal(\"live attestation unavailable: deploy on Apple Silicon macOS or disable Live accounts\")\n    }\n}","handlingStrategy":"validation","validationCode":"// startup guard for deployments\nif runtime.GOOS != \"darwin\" && cfg.LiveEnabled {\n    return fmt.Errorf(\"live attestation requires macOS; disable live accounts on %s\", runtime.GOOS)\n}","typeGuard":null,"tryCatchPattern":"if err := provider.Check(ctx); err != nil {\n    if errors.Is(err, liveattestation.ErrUnsupportedPlatform) {\n        return configError(\"deploy on Apple Silicon macOS or disable the Live provider\")\n    }\n    return err\n}","preventionTips":["Fail fast at startup, not per-request","Document OS requirements next to Live account config","Use errors.Is against the sentinel"],"tags":["platform","macos","live","attestation","deployment"],"backgroundTag":null,"analyzedSha":"073e92d17178a1ccdb0a27017f572f10c9c7ab62","analyzedAt":"2026-08-15T14:33:00.750Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}