Getting 'project not identified' error when using Jira search_issues function

I’m having trouble with the Jira search_issues function. It keeps giving me an error saying ‘XYZ not identified as project’. I’ve double-checked the project name and tried different formats, but nothing seems to work.

Here’s a simplified version of my code:

from jira_api import JiraConnection

jira_url = 'https://mycompany.jira.com'
api_key = 'my_api_key'
user_id = 'my_user_id'

connection_params = {
    'url': jira_url,
    'token': api_key,
    'user': user_id
}

jira_client = JiraConnection(connection_params)
result = jira_client.find_tickets('project = "MyProject"')

print(result)

I’ve made sure the authentication is correct. The error always says the same thing about the project not being identified. I’ve tried the project’s full name, short name, with and without quotes, but no luck. Any ideas on what might be causing this?

I’ve encountered this issue before, and it can be frustrating. One thing that solved it for me was using the project key instead of the project name. The project key is usually a short code, like ‘MP’ for ‘MyProject’.

Try modifying your JQL query to use the project key:

result = jira_client.find_tickets(‘project = MP’)

If that doesn’t work, double-check your permissions. Sometimes, even if you have access to Jira, you might not have the right permissions for that specific project. Ask your Jira admin to verify your access rights.

Another thing to try is to use the exact project ID number. You can find this in the URL when you’re viewing the project in Jira. It might look something like:

result = jira_client.find_tickets(‘project = 10000’)

Hope one of these solutions helps!

hey mate, had similar issue. try using project key instead of name. like this:

result = jira_client.find_tickets(‘project = MP’)

if that doesnt work, check ur permissions. sometimes u think u have access but u dont. ask ur jira admin to double check for ya.

I’ve dealt with this pesky error before. Have you verified that the project actually exists in your Jira instance? Sometimes projects get archived or deleted without us realizing.

Try running a simple JQL query directly in Jira’s issue search to confirm the project is accessible. If it works there but not in your code, the issue might be with your API connection or permissions.

Also, check if there are any special characters or spaces in your project name. If so, try URL encoding the project name in your query string.

Lastly, ensure your API token hasn’t expired. Jira tokens typically have a limited lifespan. Generating a fresh token might resolve the issue if everything else checks out.