Skip to content

Problem: Issue in SQL statement - vanilla install #3558

@3isenHeiM

Description

@3isenHeiM

Issue

I wanted to try Semaphore and I ran this docker-compose, form the online compose configurator:

services:
    semaphore_db:
        image: postgres:14
        restart: unless-stopped
        environment:
            POSTGRES_USER: semaphore
            POSTGRES_PASSWORD: changeme
            POSTGRES_DB: semaphore
        volumes:
            - semaphore_postgres:/var/lib/postgresql
        networks:
            - semaphore_net
        healthcheck:
          test: ["CMD-SHELL", "pg_isready -U semaphore -d semaphore"]
          interval: 5s
          timeout: 5s
          retries: 5
          start_period: 5s    

    semaphore:
        ports:
            - 3000:3000
        image: semaphoreui/semaphore:latest
        restart: unless-stopped
        depends_on:
          semaphore_db:
            condition: service_healthy
        environment:
            SEMAPHORE_DB_DIALECT: postgres
            SEMAPHORE_DB_HOST: semaphore_db
            SEMAPHORE_DB_PORT: "5432"
            SEMAPHORE_DB_NAME: semaphore
            SEMAPHORE_DB_USER: semaphore
            SEMAPHORE_DB_PASS: changeme
            SEMAPHORE_DB_OPTIONS: '{ "sslmode": "disable" }'
            SEMAPHORE_PLAYBOOK_PATH: /tmp/semaphore/
            SEMAPHORE_ADMIN_PASSWORD: changeme
            SEMAPHORE_ADMIN_NAME: admin
            SEMAPHORE_ADMIN_EMAIL: admin@test.local
            SEMAPHORE_ADMIN: admin
            SEMAPHORE_ACCESS_KEY_ENCRYPTION: 2FGAHyAv96Ob5qzUh6qz9+JzlWPiiLKHIcsMYtNuo8U=
        volumes:
            - semaphore_config:/etc/semaphore
        networks:
            - semaphore_net
volumes:
    semaphore_config:
    semaphore_postgres:
networks:
    semaphore_net: {driver: "bridge"}

I'm getting this error:

Container semaphore-ui-semaphore_db-1 Waiting 
semaphore_db-1  | 
semaphore_db-1  | PostgreSQL Database directory appears to contain a database; Skipping initialization
semaphore_db-1  | 
semaphore_db-1  | 2026-01-09 08:33:27.462 UTC [1] LOG:  starting PostgreSQL 14.20 (Debian 14.20-1.pgdg13+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 14.2.0-19) 14.2.0, 64-bit
semaphore_db-1  | 2026-01-09 08:33:27.462 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
semaphore_db-1  | 2026-01-09 08:33:27.462 UTC [1] LOG:  listening on IPv6 address "::", port 5432
semaphore_db-1  | 2026-01-09 08:33:27.468 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
semaphore_db-1  | 2026-01-09 08:33:27.473 UTC [26] LOG:  database system was shut down at 2026-01-09 08:29:42 UTC
semaphore_db-1  | 2026-01-09 08:33:27.481 UTC [1] LOG:  database system is ready to accept connections
Container semaphore-ui-semaphore_db-1 Healthy 
semaphore-1     | Pinging database on semaphore_db port 5432...
semaphore-1     | No additional python dependencies to install
semaphore-1     | Starting semaphore server
semaphore-1     | Loading config
semaphore-1     | Validating config
semaphore-1     | Executing migration v2.16.50 (at 2026-01-09 08:33:33.140818406 +0000 UTC)...
semaphore-1     | time="2026-01-09T08:33:33Z" level=warning msg="\n ERR! Query: {{if .Sqlite}}\n{{else}}\nalter table \"project__terraform_inventory_state\" change \"state\" \"state\" text not null\n\n"
semaphore-1     | time="2026-01-09T08:33:33Z" level=fatal msg="pq: syntax error at or near \"{\""
semaphore_db-1  | 2026-01-09 08:33:33.141 UTC [42] ERROR:  syntax error at or near "{" at character 1
semaphore_db-1  | 2026-01-09 08:33:33.141 UTC [42] STATEMENT:  {{if .Sqlite}}
semaphore_db-1  | 	{{else}}
semaphore_db-1  | 	alter table "project__terraform_inventory_state" change "state" "state" text not null
 [1/113]e-1     | 
semaphore-1 exited with code 1 (restarting)

From what I read, postgres throws an error at the {{if .Sqlite }} statement : pq: syntax error at or near \"{\".

How can I fix this ?

Impact

Docker

Installation method

Docker

Database

Postgres

Browser

No response

Semaphore Version

2.16.50

Ansible Version

Logs & errors

Pinging database on semaphore_db port 5432...
No additional python dependencies to install
Starting semaphore server
Loading config
Validating config
Executing migration v2.16.50 (at 2026-01-09 08:33:33.140818406 +0000 UTC)...
time="2026-01-09T08:33:33Z" level=warning msg="\n ERR! Query: {{if .Sqlite}}\n{{else}}\nalter table \"project__terraform_inventory_state\" change \"state\" \"state\" text not null\n\n"
time="2026-01-09T08:33:33Z" level=fatal msg="pq: syntax error at or near \"{\""

Manual installation - system information

No response

Configuration

No response

Additional information

No response

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