Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate key value violates unique constraint "pg_extension_name_index" #1561

Closed
digvjs opened this issue Dec 29, 2024 · 5 comments
Closed
Labels
bug Something isn't working

Comments

@digvjs
Copy link

digvjs commented Dec 29, 2024

Hi All,

I cloned the repository https://github.com/elizaos/eliza.git and checked out the v0.1.7-alpha.1 tag. The database adapter I am using is the PostgreSQL vector DB, specifically the Docker image pgvector/pgvector:pg16 from Docker Hub.

Upon running pnpm start, the PostgreSQL database is populated with all the required tables, but I encounter the following error (see the attached image):

Screenshot 2024-12-29 at 7 51 52 PM

This issue occurs even when I do a fresh clone of the eliza project.

Environment Details:

Node version: 23.3.0
pnpm version: 9.15.2
PostgreSQL Docker Image: pgvector/pgvector:pg16

Thanks in Advance!

@digvjs digvjs added the bug Something isn't working label Dec 29, 2024
Copy link
Contributor

Hello @digvjs! Welcome to the ai16z community. Thank you for opening your first issue; we appreciate your contribution. You are now a ai16z contributor!

@AIFlowML
Copy link
Collaborator

AIFlowML commented Jan 2, 2025

Can you update me on this ?
Did you made it to run ?
Cav you do clean that db entry and try another run?

@digvjs
Copy link
Author

digvjs commented Jan 2, 2025

Modified the schema.sql and added below code -

DROP EXTENSION IF EXISTS vector;

DO $$ BEGIN
        IF NOT EXISTS (SELECT 1 FROM pg_extension WHERE extname = 'vector') THEN
                CREATE EXTENSION vector;
        END IF;
END $$;

There is no other place I am creating the extension again.

Still getting below errors -

["✓ Successfully connected to PostgreSQL database"] 

 ⛔ ERRORS
   Error starting agent for character Eliza: 
   {"length":328,"name":"error","severity":"ERROR","code":"23505","detail":"Key (extname)=(vector) already exists.","where":"SQL statement \"CREATE EXTENSION vector\"\nPL/pgSQL function inline_code_block line 3 at SQL statement","schema":"pg_catalog","table":"pg_extension","constraint":"pg_extension_name_index","file":"nbtinsert.c","line":"666","routine":"_bt_check_unique"} 

 ["⛔ error: duplicate key value violates unique constraint \"pg_extension_name_index\""] 

 ⛔ ERRORS
   Error starting agents: 
   {"length":328,"name":"error","severity":"ERROR","code":"23505","detail":"Key (extname)=(vector) already exists.","where":"SQL statement \"CREATE EXTENSION vector\"\nPL/pgSQL function inline_code_block line 3 at SQL statement","schema":"pg_catalog","table":"pg_extension","constraint":"pg_extension_name_index","file":"nbtinsert.c","line":"666","routine":"_bt_check_unique"} 

 ["◎ Run `pnpm start:client` to start the client and visit the outputted URL (http://localhost:5173) to chat with your agents"] 

 ["✓ REST API bound to 0.0.0.0:3000. If running locally, access it at http://localhost:3000."] 

@AIFlowML
Copy link
Collaborator

AIFlowML commented Jan 3, 2025

Deffo need to look in the PG

AIFlowML added a commit to AIFlowML/eliza_aiflow that referenced this issue Jan 3, 2025
- Add proper checks for vector extension existence

- Create extensions schema if not exists

- Add extensions schema to search path

- Ensure idempotent schema creation
shakkernerd added a commit that referenced this issue Jan 4, 2025
…sion

fix(postgres): Handle vector extension creation properly (#1561)
shakkernerd added a commit that referenced this issue Jan 4, 2025
…ector-extension

Revert "fix(postgres): Handle vector extension creation properly (#1561)"
astinz added a commit to mcxross/eliza that referenced this issue Jan 4, 2025
* 'develop' of github.com:elizaOS/eliza: (478 commits)
  chore: bump version to v.0.1.7
  fix: generatioon tests for trimTokens
  chore: install with no frozen-lockfile flag
  Revert "fix(postgres): Handle vector extension creation properly (elizaOS#1561)"
  chore: remove unused import and var
  Removed FerePro plugin
  fix: line break handling in chat
  fix: handle env using runtime getSetting function
  feat: add validation to trimTokens
  feat: add JsDoc to trimTokens function
  Move encoding into try block to handle potential errors during model encoding.
  fall back if unsupported type
  fix(client): improve Windows compatibility for Vite dev server
  remove tokenizer service
  clean code
  restore test
  clean code
  move trimTokens to core
  feat: add Serbian README translation and enhance main README with new features and setup instructions
  use elizaLogger
  ...
@AIFlowML
Copy link
Collaborator

AIFlowML commented Jan 6, 2025

This is probably closed by the PR i push (#1743)
I close this now and anyway i wilkl discuss a strategy to keep PG and Supabase completely aligned.

@AIFlowML AIFlowML closed this as completed Jan 6, 2025
1to3for5vi7ate9x pushed a commit to 1to3for5vi7ate9x/eliza that referenced this issue Jan 26, 2025
- Add proper checks for vector extension existence

- Create extensions schema if not exists

- Add extensions schema to search path

- Ensure idempotent schema creation
1to3for5vi7ate9x pushed a commit to 1to3for5vi7ate9x/eliza that referenced this issue Jan 26, 2025
…r-extension

fix(postgres): Handle vector extension creation properly (elizaOS#1561)
1to3for5vi7ate9x pushed a commit to 1to3for5vi7ate9x/eliza that referenced this issue Jan 26, 2025
…-1561-vector-extension

Revert "fix(postgres): Handle vector extension creation properly (elizaOS#1561)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants