Skip to content
Connect > Client Libraries

Troubleshooting Client Libraries

This page lists problems a 3forge Enterprise client program can meet, starting with failures that give no error, then the exact messages each client shows and how to fix them.

The client connects but queries return nothing

A client whose certificate the server refuses gets no error from add_cluster. Queries then return {} in Python, or no result set with an empty error in C++.

The client-side signs are in on_log:

  • Python on Windows: on_connect fires, then an error Synchronous operation failed: Invalid handshake message length: 0.
  • C++ on Linux: on_connect fires, then an error Synchronous operation failed: sslv3 alert bad certificate (SSL routines).
  • C++ on Windows: on_connect does not fire. A warning Connect to <host>:<port> failed: tls alert certificate unknown (SSL routines); next attempt in <n>s repeats, and a synchronous add_cluster waits until AMI_SYNC_TIMEOUT_MS ends.

The server logs the cause. Check the instance's log for one of:

Server log Cause Fix
SSLException: java.security.cert.CertificateException: Client public key does not match any authorized keys The certificate's key is not in keys/3forge.auth, or was added since the server started Add the ssh-rsa line and restart. See Authorizing a client
A line containing null cert chain The client sent no certificate Set client_cert_file and client_key_file on every shard
A line containing Received fatal alert: unknown_ca The client's pin file does not hold the server's key Set trusted_server_pub_file to the server's keys/3forge.pub

A wrong server pin file, trusted_server_pub_file, gives the same symptoms on the client, except that the C++ client on Windows warns certificate verify failed (SSL routines). The server log tells them apart, as above.

A published object is not in the table

The Relay replies OK, object accepted before the object reaches a table, so the reply does not show it was stored. Check, in order:

  1. Check that the table has an I column and a column for every field. A table created with CREATE PUBLIC TABLE rejects objects with unknown fields, including the id. Let a publish create the table, or add I String and every field to it.
  2. Check that expires_on_ms is 0. A time in the future stops the object being stored.
  3. Check that the cluster name is right. A publish to a name the client does not have is dropped: Python logs an on_log error Failed to send message: Cluster not found [<name>], and C++ logs nothing.

A subscription receives nothing

  • A misspelled table name: subscribing to a table that does not exist is reported as a success. Check the name with SELECT TableName FROM __TABLE.
  • A refused certificate: see The client connects but queries return nothing.
  • A C++ filter that matches nothing: only rows that match the filter when they are first sent are delivered. A row that matches only after a later change is never sent.

A query returns exactly 10,000 rows

The row limit, query_limit, is 10,000 by default, and a query that matches more rows returns 10,000 with no sign that rows were left out. Raise the limit, or count first with SELECT count(*). In the ODBC driver the setting is "Rows Fetch Size".

Messages from the Python and C++ clients

Message Cause Fix
JDBC login refused by server: 005-AUTHENTICATION FAILED: BAD_CREDENTIALS Wrong username or password on the SQL connection Use a login the instance accepts
Synchronous operation did not complete within <n>ms; returning without it. A connection in this cluster is most likely retrying a login that cannot succeed (see AMI_SYNC_TIMEOUT_MS) A connection did not finish connecting or logging in within AMI_SYNC_TIMEOUT_MS Check the certificate, the credentials, and the host and port
Failed to execute SQL query: Cluster not found [<name>] The call names a cluster the client does not have Use the name given to AmiCluster or ami::Cluster
Connect to <host>:<port> failed: tls alert certificate unknown (SSL routines); next attempt in <n>s C++ on Windows: the server refused the client certificate Add the key and restart. See Authorizing a client
Connect to <host>:<port> failed: certificate verify failed (SSL routines); next attempt in <n>s C++ on Windows: the server's key is not the one in the pin file Set trusted_server_pub_file to the server's keys/3forge.pub
[shard 0] 009-EXCEPTION: Unknown table: <table> The table does not exist Check the name
schema of table '<table>' differs from the data: ... sql_insert data whose columns do not match the table Send exactly the table's columns
[shard 0] 009-EXCEPTION: Table not found for Upload: <table> sql_bulk_insert, C++ sql_insert, or sql_insert(..., create_table_if_not_exist=False) into a missing table; or sql_replace with a suffix the server rejects, such as a historical one or one starting with USE Create the table first, or correct the suffix
[shard 0] 009-EXCEPTION: Column not found in table '<table>': <column> from sql_replace A column the table does not have. The table has already been emptied Send the table's columns, then reload the rows
All columns must have the same row count Columns of different lengths Make every column the same length
Column '<name>' must be a list or ndarray A numpy datetime64 column Convert it to integers
Received message with unknown type: M@...\|Q=<n>\|S=0\|M="OK, object accepted" The Relay's normal reply to a publish, logged instead of delivered to on_message_received, against a Relay on Windows Set UNIX_MODE on the Relay connection. Without it, S=0 means accepted
Received message with unknown type: E@..., and the Web waits after a command is run A command call from a Relay on Windows, which does not reach on_command Set UNIX_MODE on the Relay connection

Messages from DB-API and SQLAlchemy

Message Cause Fix
OperationError: failed to connect to AMI server at '<host>:<port>': no response to validation query ... The connection's check query got no answer, as when the certificate is refused See The client connects but queries return nothing
TypeError: connect() got an unexpected keyword argument 'timeout'. Did you mean 'timeout_ms'? A SQLAlchemy URL parameter the driver does not take Use timeout_ms
CompileError: ... can't render element of type DATE A Date column in create_all() Use DateTime
009-EXCEPTION: Variable required from create_all() A column with unique=True Leave out unique=True

Messages from the Java client

Message Cause Fix
General error: missing @ for string '...', with unreadable characters between the quotes, repeating many times a second AmiClient.start(host, port, ...) against a secured port Open a TLS socket with a client keystore and use start(socket, ...)
Error on flush, disconnecting amiclient, repeating AmiClient.start(host, port, ..., file, password) against a secured port: no client certificate is sent Use start(socket, ...). Messages sent meanwhile are lost
License File not found. ... and Exiting with code 23 AmiCenterClient started without a license Start the JVM with -Df1.license.file=<path>
A warning about a closed socket after close() The reader thread stopping None
IllegalStateException: not connected A message sent while disconnected Reconnect first; the client does not queue messages

Messages from the ODBC driver

Message Cause Fix
HY000 Failed to establish connection A wrong host or port, a missing client certificate, a server key that does not match, or a timeout Set _3F_ODBC_LOG_LEVEL to debug and check the driver's log, C:\ProgramData\3forge_odbc\3f_odbc_driver.log
HYC00 Transactions not supported Autocommit turned off Connect with autocommit on
HY000 query failed: JDBC login refused by server: 005-AUTHENTICATION FAILED: BAD_CREDENTIALS, at the first query after a successful connect A wrong user name or password Correct the login
No message: the connect succeeds and queries return no result set The server refused the client certificate, or the "SSL Server Pub File" path does not exist Authorize the client's key and restart, or correct the path. See Authorizing a client
HYC00 Unsupported parameter C type A date, time, or binary parameter Pass the value as text or a number
HY000 009-EXCEPTION: Left side of declaration must be a variable A WHERE clause with >=, <=, or !=, which the driver rewrites Use NOT (n < 2) for n >= 2, NOT (n > 2) for n <= 2, and NOT (n = 2) for n != 2