appwrite / appwrite/sdk-for-go

🐛 Bug Report: When a collection is already created it panics with nil pointer dereference error

Open
#26 1 comment 1 reaction 0 assignees View on GitHub
bug
Dominant language
Go
Stars
94
Forks
29
Avg merge
3h 16m
Merged PRs (30d)
8

Description

### 👟 Reproduction steps

Error is coming from the `CreateCollection` method. (Line no 42)
If the collection already exists it panics. if i delete the collection then it creates for the first server run and goes well. next server run fails again as it tries to re-create the collection. suggestions?
![Image](https://github.com/user-attachments/assets/912aca20-358f-4d1e-8785-339241150cc8)

![Image](https://github.com/user-attachments/assets/88d17be3-335d-46e7-8ead-94dcbbb6f657)

### 👍 Expected behavior

It shouldn't give me this error

### 👎 Actual Behavior

It should have run fine without any complaint. If the collection is already created it should give error or it should try to create it again but it shouldn't panic.

### 🎲 Appwrite version

Different version (specify in environment)

### 💻 Operating system

Windows

### 🧱 Your Environment

using the latest github.com/appwrite/sdk-for-go version

### 👀 Have you spent some time to check if this issue has been raised before?

- [x] I checked and didn't find similar issue

### 🏢 Have you read the Code of Conduct?

- [x] I have read the [Code of Conduct](https://github.com/appwrite/appwrite/blob/HEAD/CODE_OF_CONDUCT.md)

Contributor guide

Open the contributing guide

Research direction

Start at the CreateCollection method around line 42 and reproduce the second server run with an existing collection. Trace the existing-collection response and confirm the completed behavior is no nil-pointer panic, then add or update coverage if the repository provides a relevant test entry point.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.