The original issue has been SOLVED! The expert's recommended runtime action injection is working perfectly:
[ELIZA] Registered action handler 'TIP_TELEGRAM_USER' from plugin 'aeternity'.
[ELIZA] Registered action handler 'CATCH_ADDRESS_INPUT' from plugin 'aeternity'.
[ELIZA] Registered action handler 'PROCESS_ADDRESS_REGISTRATION' from plugin 'aeternity'.
However, a new critical issue has emerged that's preventing the bot from processing ANY messages:
The agent starts successfully but cannot process messages because the MessageManager fails to initialize due to database adapter issues.
-
Database Adapter Failure:
[ELIZA] Database adapter is not available or does not have expected methods [ELIZA] Critical: Database adapter could not be initialized. -
MessageManager Initialization Failure:
[ELIZA] CRITICAL: Cannot initialize MessageManager in initialize() - databaseAdapter is still not available! -
Message Processing Blocked:
[ELIZA] CRITICAL: MessageManager is not initialized. Cannot process message.
- ✅ Agent starts successfully
- ✅ Telegram bot connects
- ✅ Action handlers register correctly
- ✅ Messages are received from Telegram
- ❌ Messages are discarded due to MessageManager not being initialized
- ❌ No LLM processing occurs
- ❌ No responses sent
The issue appears to be in the findDatabaseAdapter() function I added to packages/agent/src/index.ts:
async function findDatabaseAdapter(runtime: AgentRuntime): Promise<IDatabaseAdapter & IDatabaseCacheAdapter | undefined> {
const databaseAdapter = runtime.databaseAdapter;
elizaLogger.debug("Setting up database adapter after runtime creation.");
if (databaseAdapter && typeof (databaseAdapter as any).close === 'function') {
// Old-style adapter with close
return databaseAdapter as IDatabaseAdapter & IDatabaseCacheAdapter;
} else if (databaseAdapter && typeof (databaseAdapter as any).disconnect === 'function') {
return databaseAdapter as IDatabaseAdapter & IDatabaseCacheAdapter;
} else {
elizaLogger.warn("Database adapter is not available or does not have expected methods");
return undefined;
}
}Database Connection Attempts (successful):
[ELIZA] [SQLiteAdapter] Successfully connected to SQLite database: /root/eliza/d3b358b8-0785-59fe-a4bf-9c817acdd674.sqlite
[ELIZA] [SQLiteAdapter] Database schema initialized successfully.
Runtime Database Assignment Failure:
[ELIZA] Setting up database adapter after runtime creation.
[ELIZA] Database adapter is not available or does not have expected methods
[ELIZA] Critical: Database adapter could not be initialized.
MessageManager Initialization Blocked:
[ELIZA] MessageManager not initialized in constructor: No messageManager in config and no databaseAdapter in config yet.
[ELIZA] CRITICAL: Cannot initialize MessageManager in initialize() - databaseAdapter is still not available!
Message Processing Failure:
[TELEGRAM_MESSAGE_HANDLER] Received raw message: {"message_id": 1434, "text": "Tip me!!"}
[ELIZA] CRITICAL: MessageManager is not initialized. Cannot process message.
-
Multiple Bot Instance Conflict (secondary issue):
error: [polling_error] ETELEGRAM: 409 Conflict: terminated by other getUpdates request -
Environment:
- ElizaOS runtime with SQLite adapter
- Telegram client with polling
- Aeternity plugin with successful action registration
-
Database Adapter Interface: What are the correct method names/interfaces that
runtime.databaseAdaptershould implement for the MessageManager to recognize it? -
Initialization Timing: Should the database adapter be assigned to the runtime before or after the
AgentRuntimeinitialization? -
SQLite Adapter Integration: How should the SQLite adapter be properly connected to enable MessageManager initialization?
-
Alternative Approach: Should we modify the runtime initialization to ensure the database adapter is properly set before MessageManager initialization?
- ✅ Original Issue: Action injection working perfectly
- ❌ New Issue: Database adapter initialization preventing message processing
- 🔄 Next Step: Resolve database adapter initialization to enable message handling
Request: Expert guidance on proper database adapter initialization sequence to enable MessageManager and message processing.