Skip to content
This repository was archived by the owner on Aug 31, 2025. It is now read-only.
This repository was archived by the owner on Aug 31, 2025. It is now read-only.

Fix for "PersistedQueryNotFound" Error in ChatListPaginationQuery #222

@sunnysktsang

Description

@sunnysktsang

Description
The current hash for ChatListPaginationQuery in queries.py is causing "PersistedQueryNotFound" errors when fetching historical messages of a chat using the get_previous_messages() method. This issue prevents users from retrieving older messages from a chat thread.

Steps to Reproduce

  1. Use the get_previous_messages() method to fetch historical messages from a chat thread.
  2. Observe the "PersistedQueryNotFound" error in the response.

Here’s a code sample to reproduce the issue:

from poe_api_wrapper import PoeApi

# Initialize the client with tokens
tokens = {
    'p-b': 'YOUR_P_B_COOKIE',
    'p-lat': 'YOUR_P_LAT_COOKIE',
}
client = PoeApi(tokens=tokens)

try:
    # Fetch the first chat from the chat history
    chat_history = client.get_chat_history(count=1)
    if chat_history['data']:
        # Get the first bot and its chat code
        bot_key = list(chat_history['data'].keys())[0]
        chat_code = chat_history['data'][bot_key][0]['chatCode']

        # Attempt to retrieve all messages from the chat
        print(f"Fetching messages for chat: {chat_code}")
        messages = client.get_previous_messages(
            bot=bot_key,
            chatCode=chat_code,
            get_all=True
        )
        print(f"Successfully retrieved {len(messages)} messages.")

except Exception as e:
    print(f"Error: {str(e)}")

Expected Behavior
The get_previous_messages() method should successfully fetch and paginate through historical messages without errors.

Actual Behavior
The method fails with a "PersistedQueryNotFound" error due to an outdated hash value for ChatListPaginationQuery.

Proposed Solution
Update the hash value for ChatListPaginationQuery in queries.py to resolve the issue. This fix has already been implemented in PR #221.

Linked PR
[PR #221: Fix: Update ChatListPaginationQuery hash to resolve pagination errors](#221)

Temporary Workaround
Manually update the ChatListPaginationQuery hash in queries.py to "c1a8fd96dd6e0a4679814182951b1e256e175587513c81b223addf931833a692".

Impact
This fix ensures successful pagination requests and maintains compatibility with the current Poe API GraphQL endpoint.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions