aureuserp/aureuserp · error · Exception

manufacturing::system.work-center-productivity-log.no-perfor

Error message

manufacturing::system.work-center-productivity-log.no-performance-productivity-loss

What it means

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.

Source

Thrown at plugins/webkul/manufacturing/src/Models/WorkCenterProductivityLog.php:205

        }

        $overrunLog = $this->replicate();

        $overrunLog->started_at = $productiveUntil;

        $overrunLog->save();

        $this->update(['finished_at' => $productiveUntil]);

        return collect([$overrunLog]);
    }

    protected function underperformanceLoss(): WorkCenterProductivityLoss
    {
        $loss = WorkCenterProductivityLoss::where('loss_type', 'performance')->first();

        if (! $loss) {
            throw new \Exception(__('manufacturing::system.work-center-productivity-log.no-performance-productivity-loss'));
        }

        return $loss;
    }
}

View on GitHub (pinned to bd7cbeeb0c)

Solutions

  1. Run the plugin's seeders/migrations that install the standard productivity losses
  2. Re-insert the missing row: WorkCenterProductivityLoss::firstOrCreate(['loss_type' => 'performance'], [...])
  3. Add a deployment step or health check asserting required loss_type rows exist

Example fix

// before - reference row missing, overrun path throws
WorkCenterProductivityLoss::where('loss_type', 'performance')->first(); // null

// after - ensure reference data during deployment
WorkCenterProductivityLoss::firstOrCreate(
    ['loss_type' => 'performance'],
    ['name' => 'Performance']
);
Defensive patterns

Strategy: validation

Validate before calling

$hasPerformanceLoss = WorkCenterProductivityLoss::where('loss_type', 'performance')->exists();
if (! $hasPerformanceLoss) {
    // fail deployment / block timer stop with an ops alert
}

Type guard

function performanceLossIsSeeded(): bool
{
    return WorkCenterProductivityLoss::where('loss_type', 'performance')->exists();
}

Try / catch

try {
    $log->stop();
} catch (\Exception $e) {
    // reference data missing - alert ops instead of failing silently; timer state is preserved
    Log::error('work_center_productivity_losses: '.$e->getMessage());
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of aureuserp/aureuserp@bd7cbeeb0c (2026-08-21). Data as JSON: /api/errors/b9f535d979c95909. Report an issue: GitHub.