semaphore icon indicating copy to clipboard operation
semaphore copied to clipboard

Problem: Issue starting Semaphore server after v2.14.0

Open guyke01 opened this issue 10 months ago • 6 comments

Issue

After upgrading to version v2.14.0 or higher the Semaphore server is not booting anymore. The following error is being generated in the logs:

cannot assign value of type string to map element of type null

After reverting to v2.13.15 the container boots again but due to the DB migration some things don't work.

Impact

Docker

Installation method

Docker

Database

MySQL

Browser

Microsoft Edge

Semaphore Version

2.14.0 / 2.14.1 / 2.14.3 / 2.14.4

Ansible Version


Logs & errors

Pinging database on mysql port 3306...
No additional python dependencies to install
Starting semaphore server
Loading config
Validating config
panic: cannot assign value of type string to map element of type null
goroutine 1 [running]:
github.com/semaphoreui/semaphore/cli/cmd.createStoreWithMigrationVersion({0xda8a64, 0x4}, 0x0, 0x0)
github.com/semaphoreui/semaphore/cli/cmd.createStore(...)
	/go/src/semaphore/cli/cmd/root.go:185 +0xd7
	/go/src/semaphore/cli/cmd/root.go:194
github.com/semaphoreui/semaphore/cli/cmd.runService()
	/go/src/semaphore/cli/cmd/root.go:64 +0x45
github.com/semaphoreui/semaphore/cli/cmd.init.func9(0xc0000fd000?, {0xda8aa4?, 0x4?, 0xda8aa8?})
	/go/src/semaphore/cli/cmd/server.go:18 +0xf
github.com/spf13/cobra.(*Command).execute(0x2298ca0, {0xc00012e580, 0x2, 0x2})
github.com/spf13/cobra.(*Command).ExecuteC(0x2297c20)
	/go/src/semaphore/vendor/github.com/spf13/cobra/command.go:1019 +0xa7b
	/go/src/semaphore/vendor/github.com/spf13/cobra/command.go:1148 +0x40c
github.com/spf13/cobra.(*Command).Execute(...)
	/go/src/semaphore/vendor/github.com/spf13/cobra/command.go:1071
github.com/semaphoreui/semaphore/cli/cmd.Execute()
main.main()
	/go/src/semaphore/cli/cmd/root.go:57 +0xc5
	/go/src/semaphore/cli/main.go:8 +0xf

Manual installation - system information

No response

Configuration

docker-compose.yml

services:
  mysql:
    restart: unless-stopped
    image: mysql:8.0
    hostname: mysql
    container_name: semaphore_db
    volumes:
      - /opt/semaphore/db:/var/lib/mysql
    environment:
      MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
      MYSQL_DATABASE: REDACTED
      MYSQL_USER: REDACTED
      MYSQL_PASSWORD: REDACTED
    networks:
      ansible:
        ipv4_address: 172.22.54.11

  semaphore:
    restart: unless-stopped
    ports:
      - 3000:3000
    image: semaphoreui/semaphore:v2.14.0
    container_name: semaphore_server
    environment:
      SEMAPHORE_DB_USER: REDACTED
      SEMAPHORE_DB_PASS: REDACTED
      SEMAPHORE_DB_HOST: mysql # for postgres, change to: postgres
      SEMAPHORE_DB_PORT: 3306 # change to 5432 for postgres
      SEMAPHORE_DB_DIALECT: mysql # for postgres, change to: postgres
      SEMAPHORE_DB: REDACTED
      SEMAPHORE_PLAYBOOK_PATH: /tmp/semaphore/
      SEMAPHORE_ADMIN_PASSWORD: REDACTED
      SEMAPHORE_ADMIN_NAME: REDACTED
      SEMAPHORE_ADMIN_EMAIL: REDACTED
      SEMAPHORE_ADMIN: REDACTED
      SEMAPHORE_SCHEDULE_TIMEZONE: Europe/Amsterdam
    depends_on:
      - mysql # for postgres, change to: postgres
    volumes:
      - /opt/semaphore/inventory/:/inventory:ro
      #- /opt/semaphore/config/config.json:/etc/semaphore/config.json:ro
    networks:
      ansible:
        ipv4_address: 172.22.54.10

networks:
  ansible:
    ipam:
      config:
        - subnet: 172.22.54.0/24

config.json

{
"ldap_enable": true,
"ldap_needtls": true,
"ldap_binddn": "REDACTED",
"ldap_bindpassword": "REDACTED",
"ldap_server": "domain.local:636",
"ldap_searchdn": "REDACTED",
"ldap_searchfilter": "(&(sAMAccountName=%s)(memberOf:1.2.840.113556.1.4.1941:=CN=GROUP))",
"ldap_mappings": {
"dn": "distinguishedName",
"mail": "mail",
"uid": "sAMAccountName",
"cn": "cn"
},
"access_key_encryption": "REDACTED=",
"cookie_encryption": "REDACTED",
"cookie_hash": "REDACTED",
"concurrency_mode": "node",
"max_parallel_tasks": 4
}

Additional information

No response

guyke01 avatar Apr 29 '25 06:04 guyke01

Hi @guyke01 please try https://github.com/semaphoreui/semaphore/releases/tag/v2.14.5

I hope it solves the issue, but I'm not sure.

fiftin avatar Apr 29 '25 13:04 fiftin

Hi @fiftin I've used the tag v2.14.5 and started the container but got the same error

Pinging database on mysql port 3306...
No additional python dependencies to install
panic: cannot assign value of type string to map element of type null
Starting semaphore server
Loading config
Validating config
goroutine 1 [running]:
github.com/semaphoreui/semaphore/cli/cmd.createStoreWithMigrationVersion({0xda7be4, 0x4}, 0x0, 0x0)
	/go/src/semaphore/cli/cmd/root.go:185 +0xd7
github.com/semaphoreui/semaphore/cli/cmd.createStore(...)
	/go/src/semaphore/cli/cmd/root.go:194
github.com/semaphoreui/semaphore/cli/cmd.runService()
	/go/src/semaphore/cli/cmd/root.go:64 +0x45
github.com/semaphoreui/semaphore/cli/cmd.init.func9(0xc0000fd000?, {0xda7c24?, 0x4?, 0xda7c28?})
github.com/spf13/cobra.(*Command).execute(0x2296ca0, {0xc00012e580, 0x2, 0x2})
	/go/src/semaphore/vendor/github.com/spf13/cobra/command.go:1019 +0xa7b
	/go/src/semaphore/cli/cmd/server.go:18 +0xf
github.com/spf13/cobra.(*Command).Execute(...)
	/go/src/semaphore/vendor/github.com/spf13/cobra/command.go:1148 +0x40c
github.com/spf13/cobra.(*Command).ExecuteC(0x2295c20)
	/go/src/semaphore/vendor/github.com/spf13/cobra/command.go:1071
github.com/semaphoreui/semaphore/cli/cmd.Execute()
	/go/src/semaphore/cli/cmd/root.go:57 +0xc5
main.main()
	/go/src/semaphore/cli/main.go:8 +0xf

guyke01 avatar Apr 29 '25 14:04 guyke01

@guyke01 can you check database table option? Do you something strange in it?

fiftin avatar Apr 29 '25 18:04 fiftin

@fiftin this is the export of the option table

+--------------------------+---------------+
| key                      | value         |
+--------------------------+---------------+
| apps.ansible.active      | true          |
| apps.powershell.active   | true          |
| apps.powershell.icon     | powershell    |
| apps.powershell.order    | 0             |
| apps.powershell.priority | 0             |
| apps.powershell.title    | Powershell    |
| apps.python.active       | false         |
| apps.python.args         | null          |
| apps.python.color        |               |
| apps.python.dark_color   |               |
| apps.python.icon         | python        |
| apps.python.order        | 0             |
| apps.python.path         | python        |
| apps.python.title        | Python Script |
| apps.terraform.active    | false         |
| apps.tofu.active         | false         |
+--------------------------+---------------+

I see there is a value null in the key apps.python.args. After i delete the value the following error appears:

panic: cannot assign value of type string to map element of type

Is there something i need to delete in the table?

guyke01 avatar Apr 29 '25 18:04 guyke01

After i deleted the row apps.python.args the container started again and works now. The issue is solved!

guyke01 avatar Apr 29 '25 19:04 guyke01

Thank you @guyke01 ! It is really helpful answer! null string shouldn't be parsed as null. I will try to reproduce soon.

And I fixed another issue with nullable value column (now it not null), haha ))

fiftin avatar Apr 29 '25 19:04 fiftin