Skip to content

[Self-hosting Docker] Error after register #721

Closed

Description

@lonagi

Description

Error: Application error: a server-side exception has occurred (see the server logs for more information).
Digest: 3993666134

Image

I check in db. all tables are ok. and videos.id exists

Reproduction

Just after first login using email on self-hosted docker see error in cap-web logs

Additional Context

  • Cap version: Latest docker image
  • Operating system, version: Debian
memberButNotOwner []
isMemberOfOrganization false
Error: Unknown column 'videos.id' in 'where clause'
    at n.execute (/app/apps/web/.next/server/chunks/9868.js:23:60430)
    at /app/apps/web/.next/server/chunks/9868.js:23:65769
    at fetch (/app/apps/web/.next/server/chunks/9113.js:1:607)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async w (/app/apps/web/.next/server/chunks/6270.js:1:3645)
    at async S.execute (/app/apps/web/.next/server/chunks/6270.js:1:2708) {
  code: 'ER_BAD_FIELD_ERROR',
  errno: 1054,
  sql: "select `videos`.`id`, `videos`.`ownerId`, `videos`.`name`, `videos`.`createdAt`, `videos`.`metadata`, COUNT(DISTINCT CASE WHEN `comments`.`type` = 'text' THEN `comments`.`id` END), COUNT(DISTINCT CASE WHEN `comments`.`type` = 'emoji' THEN `comments`.`id` END), \n" +
    '        COALESCE(\n' +
    '          JSON_ARRAYAGG(\n' +
    '            JSON_OBJECT(\n' +
    "              'id', `organizations`.`id`,\n" +
    "              'name', `organizations`.`name`,\n" +
    "              'iconUrl', `organizations`.`iconUrl`\n" +
    '            )\n' +
    '          ),\n' +
    '          JSON_ARRAY()\n' +
    '        )\n' +
    '      , \n' +
    '        COALESCE(\n' +
    '          (\n' +
    '            SELECT JSON_ARRAYAGG(\n' +
    '              JSON_OBJECT(\n' +
    "                'id', s.id,\n" +
    "                'name', s.name,\n" +
    "                'organizationId', s.organizationId,\n" +
    "                'iconUrl', s.iconUrl,\n" +
    "                'isOrg', s.isOrg\n" +
    '              )\n' +
    '            )\n' +
    '            FROM (\n' +
    '              -- Include spaces where the video is directly added via space_videos\n' +
    '              SELECT DISTINCT \n' +
    '                s.id, \n' +
    '                s.name, \n' +
    '                s.organizationId, \n' +
    '                o.iconUrl as iconUrl,\n' +
    '                FALSE as isOrg\n' +
    '              FROM space_videos sv\n' +
    '              JOIN spaces s ON sv.spaceId = s.id\n' +
    '              JOIN organizations o ON s.organizationId = o.id\n' +
    '              WHERE sv.videoId = `videos`.`id`\n' +
    '              \n' +
    '              UNION\n' +
    '              \n' +
    '              -- For organization-level sharing, include the organization details\n' +
    '              -- and mark it as an organization with isOrg=TRUE\n' +
    '              SELECT DISTINCT \n' +
    '                o.id as id, \n' +
    '                o.name as name, \n' +
    '                o.id as organizationId, \n' +
    '                o.iconUrl as iconUrl,\n' +
    '                TRUE as isOrg\n' +
    '              FROM shared_videos sv\n' +
    '              JOIN organizations o ON sv.organizationId = o.id\n' +
    '              WHERE sv.videoId = `videos`.`id`\n' +
    '            ) AS s\n' +
    '          ),\n' +
    '          JSON_ARRAY()\n' +
    '        )\n' +
    '      , `users`.`name`, \n' +
    '        COALESCE(\n' +
    "          JSON_UNQUOTE(JSON_EXTRACT(`videos`.`metadata`, '$.customCreatedAt')),\n" +
    '          `videos`.`createdAt`\n' +
    '        )\n' +
    "      , IF(`videos`.`password` IS NULL, 0, 1) from `videos` left join `comments` on `videos`.`id` = `comments`.`videoId` left join `shared_videos` on `videos`.`id` = `shared_videos`.`videoId` left join `organizations` on `shared_videos`.`organizationId` = `organizations`.`id` left join `users` on `videos`.`ownerId` = `users`.`id` where `videos`.`ownerId` = '7gg3fnvpcn89grd' group by `videos`.`id`, `videos`.`ownerId`, `videos`.`name`, `videos`.`createdAt`, `videos`.`metadata`, `users`.`name` order by COALESCE(\n" +
    "      JSON_UNQUOTE(JSON_EXTRACT(`videos`.`metadata`, '$.customCreatedAt')),\n" +
    '      `videos`.`createdAt`\n' +
    '    ) desc limit 15',
  sqlState: '42S22',
  sqlMessage: "Unknown column 'videos.id' in 'where clause'",
  digest: '3993666134'

Activity

  1. added
    bug
    on Jul 4, 2025
  2. linear commented on Jul 4, 2025

    @linear
  3. Bxnnet commented on Jul 23, 2025

    @Bxnnet

    I have the same issue, any news here?

  4. lonagi commented on Jul 23, 2025

    @lonagi
    Author

    I have the same issue, any news here?

    Nope(

    I even reinstalled app with new updates in repo after some days, but still this error

  5. mogita commented on Jul 23, 2025

    @mogita
    Contributor

    Facing the same error with container install (running on K8s). DB migration completed without issue, user logged in OK, but upon loading the dashboard it goes sqlMessage: "Unknown column 'videos.id' in 'WHERE'".

  6. mogita commented on Jul 24, 2025

    @mogita
    Contributor

    Created a PR to address the dashboard crash caused by improper correlation in the raw SQL.

    A test build with this patch can be pulled here:

    docker pull ghcr.io/mogita/cap-web:fix-videos-id-error.3
    

    Please let me know for any thoughts. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions