{"record":{"id":"4809d9b10f04b38f","repo":"thephpleague/flysystem","slug":"at-least-one-prefix-is-required","errorCode":null,"errorMessage":"At least one prefix is required.","messagePattern":"At least one prefix is required\\.","errorType":"validation","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"src/UrlGeneration/ShardedPrefixPublicUrlGenerator.php","lineNumber":27,"sourceCode":"use function array_map;\nuse function count;\nuse function crc32;\n\nfinal class ShardedPrefixPublicUrlGenerator implements PublicUrlGenerator\n{\n    /** @var PathPrefixer[] */\n    private array $prefixes;\n    private int $count;\n\n    /**\n     * @param string[] $prefixes\n     */\n    public function __construct(array $prefixes)\n    {\n        $this->count = count($prefixes);\n\n        if ($this->count === 0) {\n            throw new InvalidArgumentException('At least one prefix is required.');\n        }\n\n        $this->prefixes = array_map(static fn (string $prefix) => new PathPrefixer($prefix, '/'), $prefixes);\n    }\n\n    public function publicUrl(string $path, Config $config): string\n    {\n        $index = abs(crc32($path)) % $this->count;\n\n        return $this->prefixes[$index]->prefixPath($path);\n    }\n}\n","sourceCodeStart":9,"sourceCodeEnd":40,"githubUrl":"https://github.com/thephpleague/flysystem/blob/b277b5dc3d56650b68904117124e79c851e12376/src/UrlGeneration/ShardedPrefixPublicUrlGenerator.php#L9-L40","documentation":"Error \"At least one prefix is required.\" thrown in thephpleague/flysystem.","triggerScenarios":"Thrown at src/UrlGeneration/ShardedPrefixPublicUrlGenerator.php:27 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":"b277b5dc3d56650b68904117124e79c851e12376","analyzedAt":"2026-08-17T04:28:35.741Z","schemaVersion":2},"datasetVersion":"2026-08-17T09:17:11.063Z"}