这个 log 是表示什么

图二是dicourse hub 连接页面

Message

Failed to handle exception in exception app middleware : ActiveRecord::RecordNotUnique : PG::UniqueViolation: ERROR:  duplicate key value violates unique constraint "index_user_api_keys_on_client_id"
DETAIL:  Key (client_id)=(f40dfe45bb4f428c14defe0d3320a3b36740a4e0813dce9b3c7ae7063e222c53) already exists.


Backtrace

rack-mini-profiler-3.3.1/lib/patches/db/pg.rb:69:in `exec_params'
rack-mini-profiler-3.3.1/lib/patches/db/pg.rb:69:in `exec_params'
activerecord-7.1.3.4/lib/active_record/connection_adapters/postgresql_adapter.rb:894:in `block (2 levels) in exec_no_cache'
activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_adapter.rb:1028:in `block in with_raw_connection'
activesupport-7.1.3.4/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_adapter.rb:1000:in `with_raw_connection'
activerecord-7.1.3.4/lib/active_record/connection_adapters/postgresql_adapter.rb:893:in `block in exec_no_cache'
activesupport-7.1.3.4/lib/active_support/notifications/instrumenter.rb:58:in `instrument'
activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract_adapter.rb:1143:in `log'
activerecord-7.1.3.4/lib/active_record/connection_adapters/postgresql_adapter.rb:892:in `exec_no_cache'
activerecord-7.1.3.4/lib/active_record/connection_adapters/postgresql_adapter.rb:872:in `execute_and_clear'
activerecord-7.1.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:64:in `internal_exec_query'
activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract/database_statements.rb:153:in `exec_insert'
activerecord-7.1.3.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:83:in `exec_insert'
activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract/database_statements.rb:191:in `insert'
activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract/query_cache.rb:25:in `insert'
activerecord-7.1.3.4/lib/active_record/persistence.rb:588:in `_insert_record'
activerecord-7.1.3.4/lib/active_record/persistence.rb:1252:in `_create_record'
activerecord-7.1.3.4/lib/active_record/counter_cache.rb:187:in `_create_record'
activerecord-7.1.3.4/lib/active_record/locking/optimistic.rb:84:in `_create_record'
activerecord-7.1.3.4/lib/active_record/encryption/encryptable_record.rb:184:in `_create_record'
activerecord-7.1.3.4/lib/active_record/attribute_methods/dirty.rb:240:in `_create_record'
activerecord-7.1.3.4/lib/active_record/callbacks.rb:445:in `block in _create_record'
activesupport-7.1.3.4/lib/active_support/callbacks.rb:110:in `run_callbacks'
activesupport-7.1.3.4/lib/active_support/callbacks.rb:952:in `_run_create_callbacks'
activerecord-7.1.3.4/lib/active_record/callbacks.rb:445:in `_create_record'
activerecord-7.1.3.4/lib/active_record/timestamp.rb:114:in `_create_record'
activerecord-7.1.3.4/lib/active_record/persistence.rb:1221:in `create_or_update'
activerecord-7.1.3.4/lib/active_record/callbacks.rb:441:in `block in create_or_update'
activesupport-7.1.3.4/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
activerecord-7.1.3.4/lib/active_record/autosave_association.rb:375:in `around_save_collection_association'
activesupport-7.1.3.4/lib/active_support/callbacks.rb:130:in `block in run_callbacks'
activesupport-7.1.3.4/lib/active_support/callbacks.rb:141:in `run_callbacks'
activesupport-7.1.3.4/lib/active_support/callbacks.rb:952:in `_run_save_callbacks'
activerecord-7.1.3.4/lib/active_record/callbacks.rb:441:in `create_or_update'
activerecord-7.1.3.4/lib/active_record/timestamp.rb:125:in `create_or_update'
activerecord-7.1.3.4/lib/active_record/persistence.rb:751:in `save!'
activerecord-7.1.3.4/lib/active_record/validations.rb:55:in `save!'
activerecord-7.1.3.4/lib/active_record/transactions.rb:313:in `block in save!'
activerecord-7.1.3.4/lib/active_record/transactions.rb:365:in `block in with_transaction_returning_status'
activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract/transaction.rb:535:in `block in within_new_transaction'
activesupport-7.1.3.4/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract/transaction.rb:532:in `within_new_transaction'
activerecord-7.1.3.4/lib/active_record/connection_adapters/abstract/database_statements.rb:344:in `transaction'
activerecord-7.1.3.4/lib/active_record/transactions.rb:361:in `with_transaction_returning_status'
activerecord-7.1.3.4/lib/active_record/transactions.rb:313:in `save!'
activerecord-7.1.3.4/lib/active_record/suppressor.rb:56:in `save!'
activerecord-7.1.3.4/lib/active_record/persistence.rb:55:in `create!'
/var/www/discourse/app/controllers/user_api_keys_controller.rb:68:in `create'
actionpack-7.1.3.4/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
actionpack-7.1.3.4/lib/abstract_controller/base.rb:224:in `process_action'
actionpack-7.1.3.4/lib/action_controller/metal/rendering.rb:165:in `process_action'
actionpack-7.1.3.4/lib/abstract_controller/callbacks.rb:259:in `block in process_action'
activesupport-7.1.3.4/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
/var/www/discourse/app/controllers/application_controller.rb:424:in `block in with_resolved_locale'
i18n-1.14.5/lib/i18n.rb:351:in `with_locale'
/var/www/discourse/app/controllers/application_controller.rb:424:in `with_resolved_locale'
activesupport-7.1.3.4/lib/active_support/callbacks.rb:130:in `block in run_callbacks'
activesupport-7.1.3.4/lib/active_support/callbacks.rb:141:in `run_callbacks'
actionpack-7.1.3.4/lib/abstract_controller/callbacks.rb:258:in `process_action'
actionpack-7.1.3.4/lib/action_controller/metal/rescue.rb:25:in `process_action'
actionpack-7.1.3.4/lib/action_controller/metal/instrumentation.rb:74:in `block in process_action'
activesupport-7.1.3.4/lib/active_support/notifications.rb:206:in `block in instrument'
activesupport-7.1.3.4/lib/active_support/notifications/instrumenter.rb:58:in `instrument'
activesupport-7.1.3.4/lib/active_support/notifications.rb:206:in `instrument'
actionpack-7.1.3.4/lib/action_controller/metal/instrumentation.rb:73:in `process_action'
actionpack-7.1.3.4/lib/action_controller/metal/params_wrapper.rb:261:in `process_action'
activerecord-7.1.3.4/lib/active_record/railties/controller_runtime.rb:32:in `process_action'
actionpack-7.1.3.4/lib/abstract_controller/base.rb:160:in `process'
actionview-7.1.3.4/lib/action_view/rendering.rb:40:in `process'
rack-mini-profiler-3.3.1/lib/mini_profiler/profiling_methods.rb:89:in `block in profile_method'
actionpack-7.1.3.4/lib/action_controller/metal.rb:227:in `dispatch'
actionpack-7.1.3.4/lib/action_controller/metal.rb:309:in `dispatch'
actionpack-7.1.3.4/lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
actionpack-7.1.3.4/lib/action_dispatch/routing/route_set.rb:32:in `serve'
actionpack-7.1.3.4/lib/action_dispatch/journey/router.rb:51:in `block in serve'
actionpack-7.1.3.4/lib/action_dispatch/journey/router.rb:131:in `block in find_routes'
actionpack-7.1.3.4/lib/action_dispatch/journey/router.rb:124:in `each'
actionpack-7.1.3.4/lib/action_dispatch/journey/router.rb:124:in `find_routes'
actionpack-7.1.3.4/lib/action_dispatch/journey/router.rb:32:in `serve'
actionpack-7.1.3.4/lib/action_dispatch/routing/route_set.rb:882:in `call'
/var/www/discourse/lib/middleware/omniauth_bypass_middleware.rb:64:in `call'
rack-2.2.9/lib/rack/tempfile_reaper.rb:15:in `call'
rack-2.2.9/lib/rack/conditional_get.rb:40:in `call'
rack-2.2.9/lib/rack/head.rb:12:in `call'
actionpack-7.1.3.4/lib/action_dispatch/http/permissions_policy.rb:36:in `call'
/var/www/discourse/lib/content_security_policy/middleware.rb:12:in `call'
/var/www/discourse/lib/middleware/anonymous_cache.rb:393:in `call'
/var/www/discourse/lib/middleware/csp_script_nonce_injector.rb:12:in `call'
/var/www/discourse/config/initializers/008-rack-cors.rb:14:in `call'
rack-2.2.9/lib/rack/session/abstract/id.rb:266:in `context'
rack-2.2.9/lib/rack/session/abstract/id.rb:260:in `call'
actionpack-7.1.3.4/lib/action_dispatch/middleware/cookies.rb:689:in `call'
actionpack-7.1.3.4/lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport-7.1.3.4/lib/active_support/callbacks.rb:101:in `run_callbacks'
actionpack-7.1.3.4/lib/action_dispatch/middleware/callbacks.rb:28:in `call'
actionpack-7.1.3.4/lib/action_dispatch/middleware/debug_exceptions.rb:29:in `call'
actionpack-7.1.3.4/lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
logster-2.20.0/lib/logster/middleware/reporter.rb:40:in `call'
/var/www/discourse/lib/freedom_patches/rails_rack_logger_from_rails_7_2.rb:35:in `call_app'
/var/www/discourse/lib/freedom_patches/rails_rack_logger_from_rails_7_2.rb:22:in `call'
/var/www/discourse/config/initializers/100-quiet_logger.rb:20:in `call'
/var/www/discourse/config/initializers/100-silence_logger.rb:29:in `call'
actionpack-7.1.3.4/lib/action_dispatch/middleware/request_id.rb:28:in `call'
/var/www/discourse/lib/middleware/enforce_hostname.rb:24:in `call'
rack-2.2.9/lib/rack/method_override.rb:24:in `call'
actionpack-7.1.3.4/lib/action_dispatch/middleware/executor.rb:14:in `call'
rack-2.2.9/lib/rack/sendfile.rb:110:in `call'
rack-mini-profiler-3.3.1/lib/mini_profiler.rb:191:in `call'
/var/www/discourse/lib/middleware/processing_request.rb:12:in `call'
message_bus-4.3.8/lib/message_bus/rack/middleware.rb:60:in `call'
/var/www/discourse/lib/middleware/request_tracker.rb:360:in `call'
actionpack-7.1.3.4/lib/action_dispatch/middleware/remote_ip.rb:92:in `call'
railties-7.1.3.4/lib/rails/engine.rb:536:in `call'
railties-7.1.3.4/lib/rails/railtie.rb:226:in `public_send'
railties-7.1.3.4/lib/rails/railtie.

你用了两个相同的client_id去请求api,这是不合法的,你必须每次生成不同的client_id去请求api

Client_id 的主键重复。

在插入表数据的时候提示约束。

你应该创建了相同的 Client_id,这个是不允许的。