{"record":{"id":"08983f0adbb2911d","repo":"amir20/dozzle","slug":"s-is-required","errorCode":null,"errorMessage":"%s is required","messagePattern":"(.+?) is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cloud/tools_notifications.go","lineNumber":169,"sourceCode":"\t\t\"name\":                 args.Name,\n\t\t\"container_expression\": args.ContainerExpression,\n\t\t\"event_expression\":     args.EventExpression,\n\t}); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn addSubscriptionResponse(deps.NotificationService, &notification.Subscription{\n\t\tName:                args.Name,\n\t\tDispatcherID:        cloudDispatcherID,\n\t\tContainerExpression: args.ContainerExpression,\n\t\tEventExpression:     args.EventExpression,\n\t})\n}\n\nfunc requireNonEmpty(fields map[string]string) error {\n\tfor name, v := range fields {\n\t\tif v == \"\" {\n\t\t\treturn fmt.Errorf(\"%s is required\", name)\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc notificationResponse(message string) *pb.CallToolResponse {\n\treturn &pb.CallToolResponse{\n\t\tSuccess: true,\n\t\tResult: &pb.CallToolResponse_Notification{Notification: &pb.NotificationResult{\n\t\t\tSuccess: true,\n\t\t\tMessage: message,\n\t\t}},\n\t}\n}\n\nfunc addSubscriptionResponse(svc NotificationService, sub *notification.Subscription) (*pb.CallToolResponse, error) {\n\tif err := svc.AddSubscription(sub); err != nil {\n\t\treturn nil, fmt.Errorf(\"creating subscription: %w\", err)","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/amir20/dozzle/blob/d9463cbe21874e44ab79db6fa63e746ca7d22928/internal/cloud/tools_notifications.go#L151-L187","documentation":"requireNonEmpty iterates the given field map and returns '<name> is required' for the first empty value. The notification-creation tools use it to enforce that mandatory fields (name, container_id, destination id, etc.) are present before building a Subscription.","triggerScenarios":"Calling executeCreateLogNotification / executeCreateMetricNotification / executeCreateEventNotification with an empty or missing field such as name, container_id, pattern, metric, threshold, or destination_id.","commonSituations":"LLM tool calls omitting optional-seeming fields that are actually required; empty strings from unset form inputs; scripts interpolating empty env vars into arguments.","solutions":["Supply every required field with a non-empty value","Check the error message; it names exactly which field was empty","Create the destination first and pass its real id instead of an empty placeholder"],"exampleFix":"// before\ncreateLogNotification({name: \"\", container_id: \"abc\", pattern: \"ERROR\"})\n// after\ncreateLogNotification({name: \"error-alert\", container_id: \"abc\", pattern: \"ERROR\"})","handlingStrategy":"validation","validationCode":"const REQUIRED = ['name','container_id']; const missing = REQUIRED.filter(k => !args[k]); if (missing.length) throw new Error(`${missing.join(',')} is required before calling the notification tool`);","typeGuard":"null","tryCatchPattern":null,"preventionTips":["Assert required fields non-empty before the tool call","Trim strings; whitespace-only equals empty here","Never interpolate possibly-unset env vars directly into required fields"],"tags":["cloud-tools","notifications","validation"],"backgroundTag":"missing-required-argument","analyzedSha":"d9463cbe21874e44ab79db6fa63e746ca7d22928","analyzedAt":"2026-09-07T10:08:55.855Z","contentChangedAt":"2026-09-07T10:08:55.855Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}