# Parse error: first path segment in URL cannot contain colon

**URL:** <https://www.thethingsnetwork.org/forum/t/parse-error-first-path-segment-in-url-cannot-contain-colon/33274>\
**Category:** The Things Stack v3\
**Created:** [January 9, 2020, 9:30pm UTC](https://www.thethingsnetwork.org/forum/t/parse-error-first-path-segment-in-url-cannot-contain-colon/33274 "2020-01-09T21:30:06Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![zaher](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/zaher/32/25844_2.png) [@zaher](https://www.thethingsnetwork.org/forum/u/zaher)\
**Post date:** [January 9, 2020, 9:30pm UTC](https://www.thethingsnetwork.org/forum/t/parse-error-first-path-segment-in-url-cannot-contain-colon/33274/1 "2020-01-09T21:30:06Z")

</div>

Anyone has an idea what I might be doing wrong? After running “docker-compose up”, I get the following:

```
stack_1 | INFO Setting up Identity Server              
stack_1 | error:cmd/internal/shared:initialize_identity_server (could not initialize Identity Server)
stack_1 | --- parse "postgres://root@cockroach:26257/ttn_lorawan?sslmode=disable": first path segment in URL cannot contain colon
ttn_stack_1 exited with code 255

```

I went ahead and edited “postgres://root@cockroach:26257/ttn\_lorawan?sslmode=disable” in docker-compose.yml and removed the first colon: “postgres//root@cockroach:26257/ttn\_lorawan?sslmode=disable”

Although that error doesn’t make sense to me, I now got a different error after removing the colons:

```
stack_1 | INFO Setting up Identity Server              
stack_1 | error:cmd/internal/shared:initialize_identity_server (could not initialize Identity Server)
stack_1 | --- dial tcp: lookup postgres on 127.0.0.11:53: server misbehaving
ttn_stack_1 exited with code 255

```

I am running everything in an Ubuntu Bionic VM on localhost or 127.0.0.1

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![zaher](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/zaher/32/25844_2.png) [@zaher](https://www.thethingsnetwork.org/forum/u/zaher)\
**Post date:** [January 9, 2020, 10:53pm UTC](https://www.thethingsnetwork.org/forum/t/parse-error-first-path-segment-in-url-cannot-contain-colon/33274/2 "2020-01-09T22:53:55Z")

</div>

I also saw this error when removing the colons only as above:

```
stack_1 | INFO Setting up Identity Server              
stack_1 | error:cmd/internal/shared:initialize_identity_server (could not initialize Identity Server)
stack_1 | --- dial tcp 127.0.0.1:5432: connect: connection refused

```

As far as I understand, port 5432 should only be available if I use the Postgres DB instead of CockroachDB. I am only using CockroachDB per the default configuration so I don’t understand why it’s trying to connect to port 5432. Maybe because CockroachDB URL became wrong after I removed the colons so now it’s falling back to postgres?

---

<div class="post-metadata">

**Author:** ![jwijngaard](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/jwijngaard/32/35697_2.png) [@jwijngaard](https://www.thethingsnetwork.org/forum/u/jwijngaard)\
**Post date:** [January 10, 2020, 9:55am UTC](https://www.thethingsnetwork.org/forum/t/parse-error-first-path-segment-in-url-cannot-contain-colon/33274/3 "2020-01-10T09:55:16Z")

</div>

Hello Zaher

I see in your post you mentiond that yo use Localhost 127.0.0.1 but in the screen you send you use “lookup postgres on 127.0.0.11”

I hope it is this typo for you 🙂

> [@zaher](#):
>
> ```auto
> stack_1 | INFO Setting up Identity Server              
> stack_1 | error:cmd/internal/shared:initialize_identity_server (could not initialize Identity Server)
> stack_1 | --- dial tcp: lookup postgres on 127.0.0.11:53: server misbehaving
> ttn_stack_1 exited with code 255
> 
> ```
> 
> I am running everything in an Ubuntu Bionic VM on localhost or 127.0.0.1

---

<div class="post-metadata">

**Author:** ![zaher](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/zaher/32/25844_2.png) [@zaher](https://www.thethingsnetwork.org/forum/u/zaher)\
**Post date:** [January 10, 2020, 4:02pm UTC](https://www.thethingsnetwork.org/forum/t/parse-error-first-path-segment-in-url-cannot-contain-colon/33274/4 "2020-01-10T16:02:54Z")

</div>

Hi @jwijngaard - thanks for replying! Actually, the error you mentioned I have seen only once when I accidentally removed both cockroach and postgres from the yml file, which is still weird and sounds to me like a bug in the container. However, if you look at the other two errors I listed, they correctly mention the IP address 127.0.0.1

So unfortunately the problem I mentioned earlier persist ☹

---

<div class="post-metadata">

**Author:** ![zaher](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/zaher/32/25844_2.png) [@zaher](https://www.thethingsnetwork.org/forum/u/zaher)\
**Post date:** [January 10, 2020, 6:22pm UTC](https://www.thethingsnetwork.org/forum/t/parse-error-first-path-segment-in-url-cannot-contain-colon/33274/5 "2020-01-10T18:22:16Z")

</div>

I switched from using CockroachDB to using Postgres instead, and now I am seeing a different error:

```
stack_1 | INFO Setting up Identity Server              
stack_1 | error:cmd/internal/shared:initialize_identity_server (could not initialize Identity Server)
stack_1 | --- error:pkg/identityserver:db_needs_migration (the database needs to be migrated)
stack_1 | --- error:pkg/identityserver/store:database_table (database table `accounts` does not exist)
stack_1 | table=accounts
ttn_stack_1 exited with code 255

```

I also noticed this in the logs which could be relevant:

```
postgres_1 | 2020-01-10 01:22:10.011 UTC [23] LOG: database system was shut down at 2020-01-09 23:24:35 UTC
postgres_1 | 2020-01-10 01:22:10.024 UTC [1] LOG: database system is ready to accept connections
```

---

<div class="post-metadata">

**Author:** ![carlomissaglia](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/carlomissaglia/32/35697_2.png) [@carlomissaglia](https://www.thethingsnetwork.org/forum/u/carlomissaglia)\
**Post date:** [January 17, 2020, 9:56pm UTC](https://www.thethingsnetwork.org/forum/t/parse-error-first-path-segment-in-url-cannot-contain-colon/33274/6 "2020-01-17T21:56:52Z")

</div>

Hi Zaher,

I got your same error. I solved following instructions on [https://thethingsstack.io/v3.3.2/guides/getting-started/running-the-stack/](https://thethingsstack.io/v3.3.2/guides/getting-started/running-the-stack/)  
I initialized tables in cockroach, created admin user and so on…  
In this way web server is up and running.

---

<div class="post-metadata">

**Author:** ![zaher](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/zaher/32/25844_2.png) [@zaher](https://www.thethingsnetwork.org/forum/u/zaher)\
**Post date:** [January 21, 2020, 3:12pm UTC](https://www.thethingsnetwork.org/forum/t/parse-error-first-path-segment-in-url-cannot-contain-colon/33274/7 "2020-01-21T15:12:48Z")

</div>

@carlomissaglia, thanks very much for helping! I ran `docker-compose pull` and it seems to have worked just fine:

```
Pulling cockroach ... done
Pulling redis ... done
Pulling stack ... done

```

However, after I run: `docker-compose run --rm stack is-db init`  
I still see the following error:

```
Starting ttn-stack_redis_1 ... done
Starting ttn-stack_cockroach_1 ... done
  INFO Connecting to Identity Server database...
parse "postgres://root@cockroach:26257/ttn_lorawan?sslmode=disable": first path segment in URL cannot contain colon
```

---

<div class="post-metadata">

**Author:** ![carlomissaglia](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/carlomissaglia/32/35697_2.png) [@carlomissaglia](https://www.thethingsnetwork.org/forum/u/carlomissaglia)\
**Post date:** [January 21, 2020, 3:37pm UTC](https://www.thethingsnetwork.org/forum/t/parse-error-first-path-segment-in-url-cannot-contain-colon/33274/8 "2020-01-21T15:37:25Z")

</div>

Hi zaher,

You have to delete “ at the begin and at the end.  
Try in this way. postgres://root@cockroach:26257/ttn\_lorawan?sslmode=disable  
BR.

---

<div class="post-metadata">

**Author:** ![zaher](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/zaher/32/25844_2.png) [@zaher](https://www.thethingsnetwork.org/forum/u/zaher)\
**Post date:** [January 23, 2020, 9:59pm UTC](https://www.thethingsnetwork.org/forum/t/parse-error-first-path-segment-in-url-cannot-contain-colon/33274/9 "2020-01-23T21:59:02Z")

</div>

That was exactly my issue! Thanks a lot @carlomissaglia!  
I was able to run without errors unitl `docker-compose up`, I got the following error:

```
stack_1 | --- error:pkg/gatewayserver:listen_frontend (failed to start frontend listener `MQTT/tls` on address `:8882`)
stack_1 | address=:8882
stack_1 | protocol=MQTT/tls
stack_1 | --- open cert.pem: no such file or directory

```

I know the cert.pem file exists in the same directory where I have `docker-compose.yml` and run the `docker-compose up` command from. I also made sure I have run `chown 866:866 ./cert.pem`. Even when I changed it to an absolute file path in the `docker-compose.yml`, I still got the same error. What could I be missing here?

---

<div class="post-metadata">

**Author:** ![system](https://www.thethingsnetwork.org/forum/uploads/default/original/3X/6/2/6250ea44fd2b0d6259489e1a92748df681e1f970.png) [@system](https://www.thethingsnetwork.org/forum/u/system)\
**Post date:** [February 8, 2020, 9:30pm UTC](https://www.thethingsnetwork.org/forum/t/parse-error-first-path-segment-in-url-cannot-contain-colon/33274/10 "2020-02-08T21:30:08Z")

</div>

This topic was automatically closed after 30 days. New replies are no longer allowed.
