Security reports - Oracle bd error- ORA-00909

Hi team,

I hope you are doing well.

We are experiencing an issue when querying the security reports in our SonarQube DCE instance running on OpenShift. The following Oracle error is being triggered:

"/api/security_reports/show?project=xxx&standard=sonarsourceSecurity&includeDistribution=false
org.apache.ibatis.exceptions.PersistenceException:

Error querying database. Cause: java.sql.SQLSyntaxErrorException: ORA-00909: invalid number of arguments"

This issue occurs when executing security-related queries, and it prevents us from retrieving the necessary reports. We have verified our database configuration, but we have not identified the root cause.

Could you please provide guidance on why this error might be occurring and how we can resolve it?

Thank you for your support.

Best regards,

Hey there.

To start with, what version of SonarQube are you using?

Sorry! We are using version 2025.1 LTA

Thanks!

I think the most useful indicator of where the problem is would come from turning on TRACE level logs (global Administration > System > Log Level) performing the action and then pinging directly in your browser the /api/security_reports/show?project=xxx&standard=sonarsourceSecurity&includeDistribution=false endpoint (to avoid other noise).

For example, this is the output on my machine:

2025.02.13 11:15:51 TRACE web[c8dcab7c-26c6-43c9-948d-35087d583497][sql] time=0ms | sql=SELECT sa.scm_account as "scm_account", u.uuid as uuid, u.login as login, u.name as name, u.email as email, u.active as "active", u.salt as "salt", u.crypted_password as "cryptedPassword", u.hash_method as "hashMethod", u.external_id as "externalId", u.external_login as "externalLogin", u.external_identity_provider as "externalIdentityProvider", u.user_local as "local", u.reset_password as "resetPassword", u.homepage_type as "homepageType", u.homepage_parameter as "homepageParameter", u.last_connection_date as "lastConnectionDate", u.last_sonarlint_connection as "lastSonarlintConnectionDate", u.created_at as "createdAt", u.updated_at as "updatedAt" FROM users u left outer join scm_accounts sa on sa.user_uuid = u.uuid WHERE u.uuid=? | params=ad2aae27-14d9-4b04-b18f-d7a022853c5f

2025.02.13 11:15:51 TRACE web[c8dcab7c-26c6-43c9-948d-35087d583497][sql] time=1ms | sql=select case when exists ( select c.uuid from components c where c.kee in ( ? ) and c.scope = 'PRJ' and c.qualifier in ( ? , ? , ? ) ) then 1 else 0 end | params=aws, VW, SVW, APP

2025.02.13 11:15:51 TRACE web[c8dcab7c-26c6-43c9-948d-35087d583497][sql] time=0ms | sql=select case when exists ( select pb.project_uuid, pb.need_issue_sync from project_branches pb join components c on pb.uuid = c.branch_uuid where c.kee in ( ? ) and pb.need_issue_sync = true ) then 1 else 0 end | params=aws

2025.02.13 11:15:51 TRACE web[c8dcab7c-26c6-43c9-948d-35087d583497][sql] time=1ms | sql=select p.uuid as uuid, p.uuid_path as uuidPath, p.branch_uuid as branchUuid, p.kee as kee, case when pr.name is not null and p.scope = 'PRJ' then pr.name else p.name end as name, case when pr.name is not null and p.scope = 'PRJ' then pr.name else p.long_name end as longName, p.description as description, p.qualifier as qualifier, p.scope as scope, p.language as language, p.path as path, p.enabled as enabled, p.copy_component_uuid as copyComponentUuid, p.private as isPrivate, p.created_at as createdAt from components p left join project_branches pb on pb.uuid = p.branch_uuid left join projects pr on pb.project_uuid = pr.uuid where p.kee=? AND (pb.is_main = true OR (pb.uuid is NULL AND (p.qualifier IN ('VW', 'SVW') OR (p.qualifier = 'TRK' AND p.scope = 'FIL')))) | params=aws

2025.02.13 11:15:51 TRACE web[c8dcab7c-26c6-43c9-948d-35087d583497][sql] time=0ms | sql=select pb.uuid as uuid, pb.project_uuid as projectUuid, pb.kee as kee, pb.branch_type as branchType, pb.merge_branch_uuid as mergeBranchUuid, pb.pull_request_binary as pullRequestBinary, pb.exclude_from_purge as excludeFromPurge, pb.need_issue_sync as needIssueSync, pb.is_main as isMain from project_branches pb where pb.uuid = ? | params=7b863eed-e5ca-41ec-af6e-9f6ae57bf822

2025.02.13 11:15:51 TRACE web[c8dcab7c-26c6-43c9-948d-35087d583497][sql] time=0ms | sql=SELECT p.uuid as uuid, p.uuid_path as uuidPath, p.branch_uuid as branchUuid, p.kee as kee, p.name as name, p.long_name as longName, p.description as description, p.qualifier as qualifier, p.scope as scope, p.language as language, p.path as path, p.enabled as enabled, p.copy_component_uuid as copyComponentUuid, p.private as isPrivate, p.created_at as createdAt FROM components p where p.uuid=? | params=7b863eed-e5ca-41ec-af6e-9f6ae57bf822

2025.02.13 11:15:51 TRACE web[c8dcab7c-26c6-43c9-948d-35087d583497][sql] time=0ms | sql=select pb.uuid as uuid, pb.project_uuid as projectUuid, pb.kee as kee, pb.branch_type as branchType, pb.merge_branch_uuid as mergeBranchUuid, pb.pull_request_binary as pullRequestBinary, pb.exclude_from_purge as excludeFromPurge, pb.need_issue_sync as needIssueSync, pb.is_main as isMain from project_branches pb where pb.uuid = ? | params=7b863eed-e5ca-41ec-af6e-9f6ae57bf822

2025.02.13 11:15:51 TRACE web[c8dcab7c-26c6-43c9-948d-35087d583497][sql] time=0ms | sql=(select p.uuid as uuid, p.kee as kee, p.name as name, p.private as isPrivate, p.description as description, p.qualifier as qualifier, null as authUuid from projects p where p.uuid = ?) UNION (select p.uuid as uuid, p.kee as kee, p.name as name, p.private as isPrivate, p.description as description, case when p.parent_uuid is null then 'VW' else 'SVW' end as qualifier, case when p.root_uuid != p.uuid then p.root_uuid else null end as authUuid from portfolios p where p.uuid = ?) | params=e04f849f-eb01-4ab0-8909-b06472b336f5, e04f849f-eb01-4ab0-8909-b06472b336f5

2025.02.13 11:15:51 TRACE web[c8dcab7c-26c6-43c9-948d-35087d583497][sql] time=0ms | sql=select ur.role from user_roles ur inner join ( (select p.uuid as uuid, p.kee as kee, p.name as name, p.private as isPrivate, p.description as description, p.qualifier as qualifier, null as authUuid from projects p) UNION (select p.uuid as uuid, p.kee as kee, p.name as name, p.private as isPrivate, p.description as description, case when p.parent_uuid is null then 'VW' else 'SVW' end as qualifier, case when p.root_uuid != p.uuid then p.root_uuid else null end as authUuid from portfolios p where p.parent_uuid is null) ) entity on entity.uuid = ur.entity_uuid where entity.uuid = ? and ur.user_uuid = ? union select gr.role from group_roles gr inner join groups_users gu on gr.group_uuid = gu.group_uuid inner join ( (select p.uuid as uuid, p.kee as kee, p.name as name, p.private as isPrivate, p.description as description, p.qualifier as qualifier, null as authUuid from projects p) UNION (select p.uuid as uuid, p.kee as kee, p.name as name, p.private as isPrivate, p.description as description, case when p.parent_uuid is null then 'VW' else 'SVW' end as qualifier, case when p.root_uuid != p.uuid then p.root_uuid else null end as authUuid from portfolios p where p.parent_uuid is null) ) entity on entity.uuid = gr.entity_uuid where entity.uuid = ? and gu.user_uuid = ? union select gr.role from group_roles gr inner join ( (select p.uuid as uuid, p.kee as kee, p.name as name, p.private as isPrivate, p.description as description, p.qualifier as qualifier, null as authUuid from projects p) UNION (select p.uuid as uuid, p.kee as kee, p.name as name, p.private as isPrivate, p.description as description, case when p.parent_uuid is null then 'VW' else 'SVW' end as qualifier, case when p.root_uuid != p.uuid then p.root_uuid else null end as authUuid from portfolios p where p.parent_uuid is null) ) entity on entity.uuid = gr.entity_uuid where entity.uuid = ? and gr.group_uuid is null | params=e04f849f-eb01-4ab0-8909-b06472b336f5, ad2aae27-14d9-4b04-b18f-d7a022853c5f, e04f849f-eb01-4ab0-8909-b06472b336f5, ad2aae27-14d9-4b04-b18f-d7a022853c5f, e04f849f-eb01-4ab0-8909-b06472b336f5

2025.02.13 11:15:51 TRACE web[c8dcab7c-26c6-43c9-948d-35087d583497][sql] time=1ms | sql=select p.prop_key as "key", p.is_empty as empty, p.text_value as textValue, p.clob_value as clobValue, p.entity_uuid as entityUuid, p.user_uuid as userUuid from properties p where p.prop_key=? and p.entity_uuid is null and p.user_uuid is null | params=sonar.multi-quality-mode.enabled

2025.02.13 11:15:51 DEBUG web[c8dcab7c-26c6-43c9-948d-35087d583497][j.io.serialization] Builtin factory: null -> new: null

... Elasticsearch

2025.02.13 11:15:51 TRACE web[c8dcab7c-26c6-43c9-948d-35087d583497][sql] time=0ms | sql=select m.component_uuid as componentUuid, m.branch_uuid as branchUuid, m.json_value as jsonValue, m.json_value_hash as jsonValueHash from measures m where m.component_uuid in ( ? ) | params=7b863eed-e5ca-41ec-af6e-9f6ae57bf822

2025.02.13 11:15:51 TRACE web[c8dcab7c-26c6-43c9-948d-35087d583497][sql] time=5ms | sql=select a.uuid, a.profile_uuid as "profileUuid", a.rule_uuid as "ruleUuid", a.failure_level as "severity", a.inheritance as "inheritance", a.impacts as "impactsString", a.prioritized_rule as "prioritizedRule", a.created_at as "createdAt", a.updated_at as "updatedAt", r.plugin_rule_key as "rulefield", r.plugin_name as "repository", r.security_standards as "securityStandards", r.is_external as "isExternal", r.name as "name", r.plugin_config_key as "configKey", r.template_uuid as "templateUuid", r.language as "language", oqp.uuid as "orgProfileUuid" from active_rules a inner join rules_profiles rp on rp.uuid = a.profile_uuid inner join org_qprofiles oqp on oqp.rules_profile_uuid = rp.uuid inner join rules r on r.uuid = a.rule_uuid and r.status != 'REMOVED' where r.rule_type in ( ? , ? ) and oqp.uuid in ( ? , ? , ? , ? , ? , ? , ? ) | params=4, 3, 41cef59a-da80-41ca-8bf9-65bab208a279, 512b626c-ce4b-4d84-990c-68e10671efb6, 6645f742-66d2-42a2-8f98-8db6063dd642, 6d2a9796-9b45-48b7-939b-d24c1d3b2590, b19235ac-1a42-4b94-84ce-aa9c82236895, cb860833-0543-4f1c-b991-d92bfc2a06e3, ce13af20-66b6-4b53-9680-26859313e8d2

2025.02.13 11:15:51 TRACE web[c8dcab7c-26c6-43c9-948d-35087d583497][sql] time=32ms | sql=select rdi.rule_uuid as "rdi_ruleUuid", rdi.software_quality as "rdi_softwareQuality", rdi.severity as "rdi_severity", CASE WHEN rt.is_system_tag = true THEN rt.value ELSE NULL END as rt_systemTags, CASE WHEN rt.is_system_tag = false THEN rt.value ELSE NULL END as rt_tags, rt.is_system_tag as "rt_isSystemTag", rt.value as "rt_value", rds.content as "rds_content", rds.uuid as "rds_uuid", rds.kee as "rds_kee", rds.context_key as "rds_contextKey", rds.context_display_name as "rds_contextDisplayName", r.uuid as "r_uuid", r.plugin_rule_key as "ruleKey", r.plugin_name as "repositoryKey", r.description_format as "descriptionFormat", r.status, r.name, r.plugin_config_key as "configKey", r.priority as "severity", r.is_template as "isTemplate", r.is_external as "isExternal", r.is_ad_hoc as "isAdHoc", r.language as "language", r.template_uuid as "templateUuid", r.def_remediation_function as "defRemediationFunction", r.def_remediation_gap_mult as "defRemediationGapMultiplier", r.def_remediation_base_effort as "defRemediationBaseEffort", r.gap_description as "gapDescription", r.security_standards as "securityStandardsField", r.rule_type as "type", r.plugin_key as "pluginKey", r.scope, r.created_at as "createdAt", r.updated_at as "updatedAt", r.note_data as "noteData", r.note_user_uuid as "noteUserUuid", r.note_created_at as "noteCreatedAt", r.note_updated_at as "noteUpdatedAt", r.remediation_function as "remediationFunction", r.remediation_gap_mult as "remediationGapMultiplier", r.remediation_base_effort as "remediationBaseEffort", r.ad_hoc_name as "adHocName", r.ad_hoc_description as "adHocDescription", r.ad_hoc_severity as "adHocSeverity", r.ad_hoc_type as "adHocType", r.education_principles as "educationPrinciplesField", r.clean_code_attribute as "cleanCodeAttribute" from rules r left outer join rule_desc_sections rds on rds.rule_uuid = r.uuid left outer join rules_default_impacts rdi on rdi.rule_uuid = r.uuid left outer join rule_tags rt on rt.rule_uuid = r.uuid where r.status != 'REMOVED' and r.is_external=false and r.is_template=false and r.rule_type in ( ? , ? ) and r.language in ( ? , ? , ? , ? , ? , ? , ? ) order by r.uuid | params=4, 3, c, cpp, docker, kotlin, py, ts, xml

The goal here is to narrow down specifically which SQL call is resulting in an error, and try to understand why.

This is a log fragment in trace mode:

2025.02.13 10:31:47 TRACE sonarqube-dce-sonarqube-dce-app-6989b7c88b-h6z2l web[b7fd9f85-89f7-4288-a6e4-761237bbff2b][tracer] curl -iX POST 'http://xxxx:9001/issues/_search?typed_keys=true&max_concurrent_shard_requests=5&search_type=query_then_fetch&batched_reduce_size=512' -d '{"size":0,"query":{"bool":{"filter":[{"term":{"branch":{"value":"8dec2933-addf-43a8-b3bd-ab36aa939e69","boost":1.0}}}],"should":[{"bool":{"filter":[{"nested":{"query":{"terms":{"impacts.softwareQuality":["SECURITY"],"boost":1.0}},"path":"impacts","ignore_unmapped":false,"score_mode":"avg","boost":1.0}}],"must_not":[{"exists":{"field":"resolution","boost":1.0}}],"adjust_pure_negative":true,"boost":1.0}},{"bool":{"filter":[{"term":{"type":{"value":"SECURITY_HOTSPOT","boost":1.0}}},{"term":{"status":{"value":"TO_REVIEW","boost":1.0}}}],"must_not":[{"exists":{"field":"resolution","boost":1.0}}],"adjust_pure_negative":true,"boost":1.0}},{"bool":{"filter":[{"term":{"type":{"value":"SECURITY_HOTSPOT","boost":1....
2025.02.13 10:31:47 TRACE sonarqube-dce-sonarqube-dce-app-6989b7c88b-h6z2l web[b7fd9f85-89f7-4288-a6e4-761237bbff2b][es] ES search request 'SearchRequest{searchType=QUERY_THEN_FETCH, indices=[issues], indicesOptions=IndicesOptions[ignore_unavailable=false, allow_no_indices=true, expand_wildcards_open=true, expand_wildcards_closed=false, expand_wildcards_hidden=false, allow_aliases_to_multiple_indices=true, forbid_closed_indices=true, ignore_aliases=false, ignore_throttled=true], types=[], routing='null', preference='null', requestCache=null, scroll=null, maxConcurrentShardRequests=0, batchedReduceSize=512, preFilterShardSize=null, allowPartialSearchResults=null, localClusterAlias=null, getOrCreateAbsoluteStartMillis=-1, ccsMinimizeRoundtrips=true, enableFieldsEmulation=false, source={"size":0,"query":{"bool":{"filter":[{"term":{"branch":{"value":"8dec2933-addf-43a8-b3bd-ab36aa939e69","boost":1.0}}}],"should":[{"bool":{"filter":[{"nested":{"query":{"terms":{"impacts.softwareQuality":["SECURITY"],"boost":1.0...
2025.02.13 10:31:47 TRACE sonarqube-dce-sonarqube-dce-app-6989b7c88b-h6z2l web[b7fd9f85-89f7-4288-a6e4-761237bbff2b][sql] time=2ms | sql=select m.component_uuid as componentUuid, m.branch_uuid as branchUuid, m.json_value as jsonValue, m.json_value_hash as jsonValueHash from measures m where m.component_uuid in ( ? ) | params=8dec2933-addf-43a8-b3bd-ab36aa939e69
2025.02.13 10:31:47 TRACE sonarqube-dce-sonarqube-dce-app-6989b7c88b-h6z2l web[b7fd9f85-89f7-4288-a6e4-761237bbff2b][sql] time=1ms | sql=SELECT a.uuid, a.profile_uuid as "profileUuid", a.rule_uuid as "ruleUuid", a.failure_level as "severity", a.inheritance as "inheritance", a.impacts as "impactsString", a.prioritized_rule as "prioritizedRule", a.created_at as "createdAt", a.updated_at as "updatedAt", r.plugin_rule_key as "rulefield", r.plugin_name as "repository", r.security_standards as "securityStandards", r.is_external as "isExternal", r.name as "name", r.plugin_config_key as "configKey", r.template_uuid as "templateUuid", r.language as "language", oqp.uuid as "orgProfileUuid" FROM active_rules a INNER JOIN rules_profiles rp ON rp.uuid = a.profile_uuid INNER JOIN org_qprofiles oqp ON oqp.rules_profile_uuid = rp.uuid INNER JOIN rules r ON r.uuid = a.rule_uuid AND r.status != 'REMOVED' WHERE (a.impacts LIKE CONCAT('%', ?, '%') OR r.rule_type = 4) AND oqp.uuid IN ( ? , ? ) | params=SECURITY, 55523403-a72b-...
2025.02.13 10:31:47 ERROR sonarqube-dce-sonarqube-dce-app-6989b7c88b-h6z2l web[b7fd9f85-89f7-4288-a6e4-761237bbff2b][o.s.s.w.WebServiceEngine] Fail to process request http://xxxx/api/security_reports/show?project=xxxx&standard=sonarsourceSecurity&includeDistribution=false
org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: java.sql.SQLSyntaxErrorException: ORA-00909: invalid number of arguments
https://docs.oracle.com/error-help/db/ora-00909/
### The error may exist in org.sonar.db.qualityprofile.ActiveRuleMapper
### The error may involve org.sonar.db.qualityprofile.ActiveRuleMapper.selectByHotspotAndSoftwareQualityAndProfileUuids-Inline
### The error occurred while setting parameters
### SQL: SELECT a.uuid, a.profile_uuid as "profileUuid", a.rule_uuid as "ruleUuid", a.failure_level as "severity", a.inheritance as "inheritance", a.impacts as "impactsString", a.prioritized_rule as "prioritizedRule", a.created_at as "createdAt", a.updated_at as "updatedAt", r.plugin_rule_key as "rulefield", r.plugin_name as "repository", r.security_standards as "securityStandards", r.is_external as "isExternal", r.name as "name", r.plugin_config_key as "configKey", r.template_uuid as "templateUuid", r.language as "language", oqp.uuid as "orgProfileUuid" FROM active_rules a INNER JOIN rules_profiles rp ON rp.uuid = a.profile_uuid INNER JOIN org_qprofiles oqp ON oqp.rules_profile_uuid = rp.uuid INNER JOIN rules r ON r.uuid = a.rule_uuid AND r.status != 'REMOVED' WHERE (a.impacts LIKE CONCAT('%', ?, '%') OR r.rule_type = 4) AND oqp.uuid IN ( ? , ? )
### Cause: java.sql.SQLSyntaxErrorException: ORA-00909: invalid number of arguments

It looks like this line is cut off (and probably holds something valuable, since it will be the rest of the parameters that Oracle is saying doesn’t match the query.

ok, this is the complete query:

2025.02.13 12:55:45 TRACE sonarqube-dce-sonarqube-dce-app-6989b7c88b-h6z2l web[120351b3-8f3b-440d-b450-006b29ce95db][sql] time=3ms | sql=SELECT a.uuid, a.profile_uuid as "profileUuid", a.rule_uuid as "ruleUuid", a.failure_level as "severity", a.inheritance as "inheritance", a.impacts as "impactsString", a.prioritized_rule as "prioritizedRule", a.created_at as "createdAt", a.updated_at as "updatedAt", r.plugin_rule_key as "rulefield", r.plugin_name as "repository", r.security_standards as "securityStandards", r.is_external as "isExternal", r.name as "name", r.plugin_config_key as "configKey", r.template_uuid as "templateUuid", r.language as "language", oqp.uuid as "orgProfileUuid" FROM active_rules a INNER JOIN rules_profiles rp ON rp.uuid = a.profile_uuid INNER JOIN org_qprofiles oqp ON oqp.rules_profile_uuid = rp.uuid INNER JOIN rules r ON r.uuid = a.rule_uuid AND r.status != 'REMOVED' WHERE (a.impacts LIKE CONCAT('%', ?, '%') OR r.rule_type = 4) AND oqp.uuid IN ( ? , ? ) | params=SECURITY, 55523403-a72b-47ea-a2bd-102889f8c3bb, a935b3a5-319a-4ff1-8df5-248d0b735dc5

Thanks. I’ve flagged this for some expert eyes.

1 Like

Same issue here. New LTA 2025.1. Standard linux installation (Non-containerized).

SELECT a.uuid, a.profile_uuid as “profileUuid”, a.rule_uuid as “ruleUuid”, a.failure_level as “severity”, a.inheritance as “inheritance”, a.impacts as “impactsString”, a.prioritized_rule as “prioritizedRule”, a.created_at as “createdAt”, a.updated_at as “updatedAt”, r.plugin_rule_key as “rulefield”, r.plugin_name as “repository”, r.security_standards as “securityStandards”, r.is_external as “isExternal”, r.name as “name”, r.plugin_config_key as “configKey”, r.template_uuid as “templateUuid”, r.language as “language”, oqp.uuid as “orgProfileUuid” FROM active_rules a INNER JOIN rules_profiles rp ON rp.uuid = a.profile_uuid INNER JOIN org_qprofiles oqp ON oqp.rules_profile_uuid = rp.uuid INNER JOIN rules r ON r.uuid = a.rule_uuid AND r.status != ‘REMOVED’ WHERE (a.impacts LIKE CONCAT(‘%’, ?, ‘%’) OR r.rule_type = 4) AND oqp.uuid IN ( ? , ? , ? , ? , ? )

Cause: java.sql.SQLSyntaxErrorException: ORA-00909: invalid number of arguments

I’m sorry nobody has come and taken a look yet! A second report is pretty serious if it’s affecting the LTA, and I’ve escalated it as such.

Hello all, and sorry for the delay on this.

I’ve identified the root cause, and it’s specific to Oracle. See the Jira ticket here for more details. I’ve added this to our current iteration and will begin working on a fix now.

1 Like

Thanks for the help! We look forward to the next version to verify it.

Hello all, FYI this fix has been merged and we expect it to be available in the upcoming 2025.1.1 patch release.

2 Likes