{"record":{"id":"beb6dd36029989bd","repo":"tailscale/tailscale","slug":"set-profile-failed-w","errorCode":null,"errorMessage":"set profile failed: %w","messagePattern":"set profile failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ipn/auditlog/extension.go","lineNumber":99,"sourceCode":"\t\treturn nil, fmt.Errorf(\"%T cannot be used as transport\", cc)\n\t}\n\n\t// Create a new log store if this is the first logger.\n\t// Otherwise, get the existing log store.\n\tstore, err := e.store.GetErr(func() (LogStore, error) {\n\t\treturn newDefaultLogStore(e.logf)\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create audit log store: %w\", err)\n\t}\n\n\tlogger := NewLogger(Opts{\n\t\tLogf:       e.logf,\n\t\tRetryLimit: 32,\n\t\tStore:      store,\n\t})\n\tif err := logger.SetProfileID(profileID); err != nil {\n\t\treturn nil, fmt.Errorf(\"set profile failed: %w\", err)\n\t}\n\tif err := logger.Start(transport); err != nil {\n\t\treturn nil, fmt.Errorf(\"start failed: %w\", err)\n\t}\n\treturn logger, nil\n}\n\nfunc (e *extension) controlClientChanged(cc controlclient.Client, profile ipn.LoginProfileView) (cleanup func()) {\n\tlogger, err := e.startNewLogger(cc, profile.ID())\n\te.mu.Lock()\n\te.logger = logger // nil on error\n\te.mu.Unlock()\n\tif err != nil {\n\t\t// If we fail to create or start the logger, log the error\n\t\t// and return a nil cleanup function. There's nothing more\n\t\t// we can do here.\n\t\t//\n\t\t// But [extension.getCurrentLogger] returns [noCurrentLogger]","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/tailscale/tailscale/blob/6e0912f97994f927632b34ae9e63b53d6516a6ac/ipn/auditlog/extension.go#L81-L117","documentation":"Raised by startNewLogger when binding the new audit logger to the current profile ID fails. It wraps the SetProfileID error; the logger cannot persist entries without a profile.","triggerScenarios":"Thrown at ipn/auditlog/extension.go:99 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Create a fresh logger per profile rather than reusing one.","Check the store for corruption."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6e0912f97994f927632b34ae9e63b53d6516a6ac","analyzedAt":"2026-08-18T08:17:25.280Z","contentChangedAt":"2026-08-18T08:17:25.280Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}