Panel login - Too many redirects

Had the same problem, the installation worked with debug: true but not debug: false.

I manually “bisected” the kirby code until I’ve found what made it work with debug: true:

Quoting https://github.com/getkirby/kirby/blob/master/kirby/registry/field.php#L40:

  public function set($name, $root, $automatic = false) {
    
    $name = strtolower($name);
    $file = $root . DS . $name . '.php';
    if(!$this->kirby->option('debug') || (is_dir($root) && is_file($file))) {
      return static::$fields[$name] = new Obj([
        'root'  => $root,
        'file'  => $file,
        'name'  => $name,
        'class' => $name . 'field',
      ]);
    } 
    if(!$automatic) throw new Exception('The field does not exist at the specified path: ' . $root);
  }

You can see there that if debug is set to false, it enters the if statement in all cases (even when (is_dir($root) && is_file($file)) evaluates to false. So I investigated my installation and found that I had an empty folder in site/fields, so kirby effectively ignored the is_dir and is_file checks and tried to load an inexisting “field”.

I guess the same would happen with empty plugin folders and similar…

PS: the problem was that someone cloned a “field” from github into the site, then tried to add and commit that field to our site repository, but obviously git ignores “repos inside other repos” and therefore just left an empty folder instead…