Skip to content

"Not unique table/alias" error only occurs when running Dusk tests (Nova 5 + Scout) #6935

@vinoles

Description

@vinoles
  • Laravel Version: 10.48
  • Nova Version: 5.0
  • PHP Version: 8.4
  • Database Driver & Version:
  • Operating System and Version: #.#
  • Browser type and version: #.#
  • Reproduction Repository: https://github.com/###/###

Description:

After upgrading to Laravel Nova 5, I started experiencing a SQL error when running Dusk tests:

SQLSTATE[42000]: Syntax error or access violation: 1066 Not unique table/alias

This issue only appears during Dusk tests — not in normal browser usage or when running feature tests.

It seems related to Laravel Scout, since disabling Scout indexing in the application normally prevents the issue. However, even when Scout is completely disabled during Dusk :

  /**
     * Determine if this resource uses Laravel Scout.
     *
     * @return bool
     */
    public static function usesScout()
    {
        return false;
    }

It looks like Nova might still internally generate duplicated table aliases for Scout-related queries under Dusk.

Detailed steps to reproduce the issue on a fresh Nova installation:

  • Have a Nova resource using Scout (useScout() enabled).
  • Run a Dusk test that visits that resource index page.
  • Observe the SQL error:
SQLSTATE[42000]: Syntax error or access violation: 1066 Not unique table/alias

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions