{"record":{"id":"b22b7dc825baf68b","repo":"apache/beam","slug":"panic-msg","errorCode":null,"errorMessage":"panic(msg)","messagePattern":"panic\\(msg\\)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"sdks/go/pkg/beam/log/log.go","lineNumber":165,"sourceCode":"\n// Errorf writes the fmt.Sprintf-formatted arguments to the global logger with\n// error severity.\nfunc Errorf(ctx context.Context, format string, v ...any) {\n\tOutput(ctx, SevError, 1, fmt.Sprintf(format, v...))\n}\n\n// Errorln writes the fmt.Sprintln-formatted arguments to the global logger with\n// error severity.\nfunc Errorln(ctx context.Context, v ...any) {\n\tOutput(ctx, SevError, 1, fmt.Sprintln(v...))\n}\n\n// Fatal writes the fmt.Sprint-formatted arguments to the global logger with\n// fatal severity. It then panics.\nfunc Fatal(ctx context.Context, v ...any) {\n\tmsg := fmt.Sprint(v...)\n\tOutput(ctx, SevFatal, 1, msg)\n\tpanic(msg)\n}\n\n// Fatalf writes the fmt.Sprintf-formatted arguments to the global logger with\n// fatal severity. It then panics.\nfunc Fatalf(ctx context.Context, format string, v ...any) {\n\tmsg := fmt.Sprintf(format, v...)\n\tOutput(ctx, SevFatal, 1, msg)\n\tpanic(msg)\n}\n\n// Fatalln writes the fmt.Sprintln-formatted arguments to the global logger with\n// fatal severity. It then panics.\nfunc Fatalln(ctx context.Context, v ...any) {\n\tmsg := fmt.Sprintln(v...)\n\tOutput(ctx, SevFatal, 1, msg)\n\tpanic(msg)\n}\n","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/log/log.go#L147-L183","documentation":"log.Fatal in the Beam Go log package writes the fmt.Sprint-formatted arguments at fatal severity to the global logger, then panics with the message. It is the logging library's terminal-failure helper: after logging, execution cannot continue, so it deliberately raises a panic that typically crashes the pipeline.","triggerScenarios":"Any application code calling log.Fatal(ctx, ...) for unrecoverable conditions — e.g. failed config loads, unreachable dependencies — in main functions, test mains, or loader helpers.","commonSituations":"Aborting on missing configuration or failed datastore/entity loads at startup; unrecoverable initialization errors in CLI tools and test setups.","solutions":["This is intentional behavior; prevent hitting it by validating config and dependencies before calling Fatal paths.","If you need controlled failure instead of a panic, log at fatal severity and return an error rather than calling Fatal.","In tests, use recover() in TestMain if you must assert that Fatal was invoked."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"defer func() {\n    if r := recover(); r != nil {\n        fmt.Fprintf(os.Stderr, \"fatal: %v\\n\", r)\n        os.Exit(1)\n    }\n}()","preventionTips":["Validate configuration and dependencies before reaching fatal paths.","Prefer returning errors over calling Fatal in reusable code.","Treat any log.Fatal call site as a process-terminating event."],"tags":["go","apache-beam","logging","fatal","panic"],"backgroundTag":"internal-invariant-violation","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}