{"record":{"id":"f3e61641655310c2","repo":"briannesbitt/Carbon","slug":"unknown-unit-unit","errorCode":null,"errorMessage":"Unknown unit '$unit'.","messagePattern":"Unknown unit '\\$unit'\\.","errorType":"exception","errorClass":"UnknownUnitException","httpStatus":null,"severity":"error","filePath":"src/Carbon/Traits/Boundaries.php","lineNumber":443,"sourceCode":"        return $this->setTime($this->hour, $this->minute, $this->second, $millisecond * 1000 + 999);\n    }\n\n    /**\n     * Modify to start of current given unit.\n     *\n     * @example\n     * ```\n     * echo Carbon::parse('2018-07-25 12:45:16.334455')\n     *   ->startOf(Unit::Month)\n     *   ->endOf(Unit::Week, Carbon::FRIDAY);\n     * ```\n     */\n    public function startOf(Unit|string $unit, mixed ...$params): static\n    {\n        $ucfUnit = ucfirst($unit instanceof Unit ? $unit->value : static::singularUnit($unit));\n        $method = \"startOf$ucfUnit\";\n        if (!method_exists($this, $method)) {\n            throw new UnknownUnitException($unit);\n        }\n\n        return $this->$method(...$params);\n    }\n\n    /**\n     * Modify to end of current given unit.\n     *\n     * @example\n     * ```\n     * echo Carbon::parse('2018-07-25 12:45:16.334455')\n     *   ->startOf(Unit::Month)\n     *   ->endOf(Unit::Week, Carbon::FRIDAY);\n     * ```\n     */\n    public function endOf(Unit|string $unit, mixed ...$params): static\n    {\n        $ucfUnit = ucfirst($unit instanceof Unit ? $unit->value : static::singularUnit($unit));","sourceCodeStart":425,"sourceCodeEnd":461,"githubUrl":"https://github.com/briannesbitt/Carbon/blob/b13f05955dcfd7da71d60af745fd148cbdb73505/src/Carbon/Traits/Boundaries.php#L425-L461","documentation":"Error \"Unknown unit '$unit'.\" thrown in briannesbitt/Carbon.","triggerScenarios":"Thrown at src/Carbon/Traits/Boundaries.php:443 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":"b13f05955dcfd7da71d60af745fd148cbdb73505","analyzedAt":"2026-08-17T04:40:56.953Z","schemaVersion":2},"datasetVersion":"2026-08-17T09:17:11.063Z"}