diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c
index 61c025ff3b..957b565f77 100644
--- a/src/interfaces/libpq/fe-connect.c
+++ b/src/interfaces/libpq/fe-connect.c
@@ -6839,7 +6839,7 @@ end:
 	/* Not at the end of the string yet?  Fail. */
 	if (*q != '\0')
 	{
-		libpq_append_error(errorMessage, "trailing data found: \"%s\"", str);
+		libpq_append_error(errorMessage, "found unexpected spaces: \"%s\". Did you forget to percent-encode spaces?", str);
 		free(buf);
 		return NULL;
 	}
