Common issues and solutions when using the pgEdge Document Loader.
Error:
Error: failed to connect to database: failed to ping database:
connection refused
Solutions:
-
Verify PostgreSQL is running:
pg_isready -h localhost -p 5432
-
Check host and port settings:
pgedge-docloader --db-host localhost --db-port 5432 ...
-
Verify network connectivity:
telnet localhost 5432
-
Check PostgreSQL is accepting connections (in
postgresql.conf):listen_addresses = '*'
Error:
Error: failed to connect to database: pq: password authentication
failed for user "myuser"
Solutions:
-
Verify password is correct
-
Set password using environment variable:
export PGPASSWORD=your_password -
Check
pg_hba.confallows the connection method -
Verify user exists:
SELECT usename FROM pg_user WHERE usename = 'myuser';
Error:
Error: failed to connect to database: pq: SSL is not enabled on the
server
Solutions:
-
Change SSL mode to
disableif SSL is not needed:pgedge-docloader --db-sslmode disable ...
-
Or enable SSL in PostgreSQL (
postgresql.conf):ssl = on -
Verify certificate paths are correct:
ls -la /path/to/cert.pem /path/to/key.pem
Error:
Processing files from: ./docs
No documents to process.
Solutions:
-
Verify source path exists:
ls -la ./docs
-
Check glob pattern syntax:
pgedge-docloader --source "./docs/*.md" ... -
Ensure files have supported extensions (
.html,.htm,.md,.rst) -
List supported formats:
pgedge-docloader formats
Error (single file):
Error: unsupported file type: document.txt
Solution:
Convert the file to a supported format or use a different file.
Message (directory):
Skipping unsupported file: readme.txt
Solution:
This is informational. Unsupported files in directories/globs are skipped automatically.
Error:
Error: failed to insert documents: pq: relation "documents" does not
exist
Solutions:
-
Create the table first (see Database Setup)
-
Verify table name is correct:
\dt
-
Check schema if using non-public schema:
--db-table myschema.documents
Error:
Error: failed to insert documents: pq: column "content" of relation
"documents" does not exist
Solutions:
-
Verify column mapping matches table structure:
\d documents
-
Update column mapping:
--col-doc-content actual_column_name
Error:
Error: failed to insert documents: pq: permission denied for table
documents
Solutions:
-
Grant necessary permissions:
GRANT SELECT, INSERT, UPDATE ON documents TO myuser; GRANT USAGE, SELECT ON SEQUENCE documents_id_seq TO myuser;
-
Verify user has permissions:
SELECT grantee, privilege_type FROM information_schema.role_table_grants WHERE table_name = 'documents';
Error:
Error: failed to insert documents: pq: duplicate key value violates
unique constraint "documents_filename_key"
Solutions:
-
Use update mode to update existing rows:
pgedge-docloader --update ...
-
Or delete existing rows:
DELETE FROM documents WHERE filename = 'duplicate.md';
-
Or remove UNIQUE constraint if not needed
Error:
Error: failed to insert documents: pq: column "source" is of type bytea
but expression is of type text
Solutions:
-
Verify column types match expectations (see Database Setup)
-
For source content, use BYTEA type:
ALTER TABLE documents ALTER COLUMN source TYPE bytea USING source::bytea;
Error:
Error: failed to load configuration: failed to read config file: open
config.yml: no such file or directory
Solutions:
-
Verify config file path:
ls -la config.yml
-
Use absolute path:
pgedge-docloader --config /full/path/to/config.yml
Error:
Error: failed to load configuration: failed to read config file: yaml:
line 5: could not find expected ':'
Solutions:
-
Validate YAML syntax:
yamllint config.yml
-
Check for correct indentation (use spaces, not tabs)
-
Ensure colons are followed by spaces
Error:
Error: failed to load configuration: source path is required
Solutions:
-
Provide required options via config file or command line
-
Required options:
sourcedb-hostdb-namedb-userdb-table- At least one column mapping
If processing is slow:
-
Database connection: Use connection pooling (already enabled)
-
Network latency: Use local database or faster network connection
-
Indexes: Ensure appropriate indexes exist (see Database Setup)
For large documents:
-
Process files in smaller batches
-
Use glob patterns to process subsets:
pgedge-docloader --source "./docs/section1/*.md" ... pgedge-docloader --source "./docs/section2/*.md" ...
If you encounter issues not covered here:
-
Check the Usage guide
-
Verify your Configuration
-
Review Database Setup
-
Run with verbose output (if available in future versions)
-
Report issues at: https://github.com/pgedge/pgedge-docloader/issues
-
Test database connection:
psql -h localhost -U myuser -d mydb
-
Test with minimal config:
pgedge-docloader \ --source testdata/sample.md \ --db-host localhost \ --db-name test \ --db-user postgres \ --db-table test_docs \ --col-doc-content content \ --col-file-name filename -
Check PostgreSQL logs:
tail -f /var/log/postgresql/postgresql-*.log -
Verify table structure:
\d+ documents -
Test manual insert:
INSERT INTO documents (content, filename) VALUES ('test', 'test.md');
To review online help on all command-line options, use the command:
pgedge-docloader --helpTo retrieve pgEdge Document Loader version information:
pgedge-docloader versionTo review a list of supported document formats:
pgedge-docloader formats