{"record":{"id":"b9f535d979c95909","repo":"aureuserp/aureuserp","slug":"manufacturing-system-work-center-productivity-log","errorCode":null,"errorMessage":"manufacturing::system.work-center-productivity-log.no-performance-productivity-loss","messagePattern":"manufacturing::system\\.work-center-productivity-log\\.no-performance-productivity-loss","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"plugins/webkul/manufacturing/src/Models/WorkCenterProductivityLog.php","lineNumber":205,"sourceCode":"        }\n\n        $overrunLog = $this->replicate();\n\n        $overrunLog->started_at = $productiveUntil;\n\n        $overrunLog->save();\n\n        $this->update(['finished_at' => $productiveUntil]);\n\n        return collect([$overrunLog]);\n    }\n\n    protected function underperformanceLoss(): WorkCenterProductivityLoss\n    {\n        $loss = WorkCenterProductivityLoss::where('loss_type', 'performance')->first();\n\n        if (! $loss) {\n            throw new \\Exception(__('manufacturing::system.work-center-productivity-log.no-performance-productivity-loss'));\n        }\n\n        return $loss;\n    }\n}\n","sourceCodeStart":187,"sourceCodeEnd":211,"githubUrl":"https://github.com/aureuserp/aureuserp/blob/bd7cbeeb0c620985dfd9b88c56be7f3ea86be6b4/plugins/webkul/manufacturing/src/Models/WorkCenterProductivityLog.php#L187-L211","documentation":"Thrown by WorkCenterProductivityLog::underperformanceLoss() (WorkCenterProductivityLog.php:205): the overrun handling path needs the reference record WorkCenterProductivityLoss with loss_type = 'performance' to categorize overrun time; when first() returns null it throws. This is seed/reference data the manufacturing plugin expects to exist, not user input.","triggerScenarios":"Stopping a timer that overran the expected duration (the code path that trims the log at $productiveUntil and creates an overrun log) on a database whose work_center_productivity_losses table has no loss_type = 'performance' row.","commonSituations":"Seeders not run after migration on a fresh environment; reference row deleted in production; environment drift (staging seeded, prod not); partial data transfer between environments.","solutions":["Run the plugin's seeders/migrations that install the standard productivity losses","Re-insert the missing row: WorkCenterProductivityLoss::firstOrCreate(['loss_type' => 'performance'], [...])","Add a deployment step or health check asserting required loss_type rows exist"],"exampleFix":"// before - reference row missing, overrun path throws\nWorkCenterProductivityLoss::where('loss_type', 'performance')->first(); // null\n\n// after - ensure reference data during deployment\nWorkCenterProductivityLoss::firstOrCreate(\n    ['loss_type' => 'performance'],\n    ['name' => 'Performance']\n);","handlingStrategy":"validation","validationCode":"$hasPerformanceLoss = WorkCenterProductivityLoss::where('loss_type', 'performance')->exists();\nif (! $hasPerformanceLoss) {\n    // fail deployment / block timer stop with an ops alert\n}","typeGuard":"function performanceLossIsSeeded(): bool\n{\n    return WorkCenterProductivityLoss::where('loss_type', 'performance')->exists();\n}","tryCatchPattern":"try {\n    $log->stop();\n} catch (\\Exception $e) {\n    // reference data missing - alert ops instead of failing silently; timer state is preserved\n    Log::error('work_center_productivity_losses: '.$e->getMessage());\n}","preventionTips":["Include reference-data seeders in the deployment pipeline","Add a health command asserting required loss_type rows exist","Protect seed rows from accidental deletion"],"tags":["manufacturing","seed-data","productivity-loss","configuration","deployment"],"backgroundTag":"missing-seed-record","analyzedSha":"bd7cbeeb0c620985dfd9b88c56be7f3ea86be6b4","analyzedAt":"2026-08-21T06:41:00.338Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}