{"record":{"id":"4408f41e312cfcc8","repo":"googleapis/mcp-toolbox","slug":"failed-to-get-logger-from-context-w-4408f4","errorCode":null,"errorMessage":"failed to get logger from context: %w","messagePattern":"failed to get logger from context: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/bigquery/bigquery.go","lineNumber":384,"sourceCode":"\treturn s.WriteMode\n}\n\nfunc (s *Source) BigQuerySession() BigQuerySessionProvider {\n\treturn s.SessionProvider\n}\n\nfunc (s *Source) newBigQuerySessionProvider() BigQuerySessionProvider {\n\treturn func(ctx context.Context) (*Session, error) {\n\t\tif s.WriteMode != WriteModeProtected {\n\t\t\treturn nil, nil\n\t\t}\n\n\t\ts.sessionMutex.Lock()\n\t\tdefer s.sessionMutex.Unlock()\n\n\t\tlogger, err := util.LoggerFromContext(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to get logger from context: %w\", err)\n\t\t}\n\n\t\tif s.Session != nil {\n\t\t\t// Absolute 7-day lifetime check.\n\t\t\tconst sessionMaxLifetime = 7 * 24 * time.Hour\n\t\t\t// This assumes a single task will not exceed 30 minutes, preventing it from failing mid-execution.\n\t\t\tconst refreshThreshold = 30 * time.Minute\n\t\t\tif time.Since(s.Session.CreationTime) > (sessionMaxLifetime - refreshThreshold) {\n\t\t\t\tlogger.DebugContext(ctx, \"Session is approaching its 7-day maximum lifetime. Creating a new one.\")\n\t\t\t} else {\n\t\t\t\tjob := &bigqueryrestapi.Job{\n\t\t\t\t\tConfiguration: &bigqueryrestapi.JobConfiguration{\n\t\t\t\t\t\tDryRun: true,\n\t\t\t\t\t\tQuery: &bigqueryrestapi.JobConfigurationQuery{\n\t\t\t\t\t\t\tQuery:                \"SELECT 1\",\n\t\t\t\t\t\t\tUseLegacySql:         new(bool),\n\t\t\t\t\t\t\tConnectionProperties: []*bigqueryrestapi.ConnectionProperty{{Key: \"session_id\", Value: s.Session.ID}},\n\t\t\t\t\t\t},","sourceCodeStart":366,"sourceCodeEnd":402,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/bigquery/bigquery.go#L366-L402","documentation":"Error \"failed to get logger from context: %w\" thrown in googleapis/mcp-toolbox.","triggerScenarios":"Thrown at internal/sources/bigquery/bigquery.go:384 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}